[mapserver-users] PHP Mapscript: generateSLD

Jean-François Gigand jean-francois at gigand.fr
Mon Feb 7 11:14:18 EST 2011


Hi,

Maybe the layer has to be enabled (STATUS property) to appear in the SLD?
If you want to keep it disabled in your mapFile, you can enable it
programmatically just before calling generateSLD() by setting "status"
to MS_ON.

Jeff


2011/2/7 Daniel Degasperi <daniel.degasperi at r3-gis.com>:
> Hi,
> I've used the function generateSLD from the layerObj class to create a sld
> snippet, but the output was a empty sld file:
>
> <StyledLayerDescriptor version="1.0.0" xmlns="http://www.opengis.net/sld"
> xmlns:gml="http://www.opengis.net/gml"
> xmlns:ogc="http://www.opengis.net/ogc"
> xmlns:xlink="http://www.w3.org/1999/xlink"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://www.opengis.net/sld
> http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd">
> </StyledLayerDescriptor>
>
> I'm using following mapfile with mapserver 5.6.5:
>
> MAP
> NAME "test.map"
> SIZE 256 256
> RESOLUTION 72
>
>
> OUTPUTFORMAT
>     NAME "aggpng24"
>     DRIVER "AGG/PNG"
>     MIMETYPE "image/png"
>     IMAGEMODE RGB
>     EXTENSION "png"
>     FORMATOPTION "INTERLACE=OFF"
>     TRANSPARENT ON
>     FORMATOPTION "INTERLACE=OFF"
> END
> WEB
>     METADATA
>         "ows_onlineresource"
> "http://dev/public/services/ows.php?map=test.map"
>         "ows_title"    "test"
>         "ows_abstract"    ""
>         "wms_feature_info_mime_type"    "text/html"
>         "ows_service_onlineresource"    ""
>         "wms_srs"    "EPSG:32632 EPSG:4326 EPSG:900913"
>
>     END
>     IMAGEPATH "/tmp/ms_tmp/"
>     IMAGEURL "/tmp/"
> END
>
> LAYER
>     GROUP "test"
>     NAME "test"
>     TYPE LINE
>     STATUS OFF
>     METADATA
>         "ows_title"    "test"
>         "ows_extent"    "482003.57067363 5006503.5706736 537996.42932637
> 5062496.4293264"
>         "ows_srs"    "EPSG:32632"
>         "gml_geometries"    "the_geom"
>
>     END
>     PROJECTION
>         "+proj=utm +zone=32 +ellps=WGS84 +datum=WGS84 +units=m +no_defs "
>     END
>     EXTENT 482003.57067363 5006503.5706736 537996.42932637 5062496.4293264
>     CONNECTIONTYPE POSTGIS
>     CONNECTION "user=test password=test dbname=test host=localhost
> port=5432"
>     DATA "the_geom FROM test USING UNIQUE gid USING SRID 32632"
>     PROCESSING "CLOSE_CONNECTION=DEFER"
>     SIZEUNITS pixels
>     CLASS
>         NAME "l103106"
>         EXPRESSION ('[code]' eq 'L103106')
>         STYLE
>             COLOR 76 230 0
>             SYMBOL "CIRCLE"
>             SIZE 3
>             MINSIZE 3
>             MAXSIZE 3
>             WIDTH 3
>             MINWIDTH 3
>         END
>     END
>     CLASS
>         NAME "l103107"
>         EXPRESSION ('[code]' eq 'L103107')
>         STYLE
>             COLOR 56 168 1
>             SYMBOL "CIRCLE"
>             SIZE 2
>             MINSIZE 2
>             MAXSIZE 2
>             WIDTH 2
>             MINWIDTH 2
>         END
>     END
> END
>
> ###### SYMBOLS #######
>
> SYMBOL
> NAME "CIRCLE"
> TYPE ELLIPSE
> FILLED TRUE
> POINTS
> 1 1
> END
> END
>
>
> END #MAP
>
> Can somebody help me?
>
> Best regards,
> Daniel
>
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>
>


More information about the mapserver-users mailing list