[mapserver-users] PHP/MapScript - Export SLD
Daniel Degasperi
daniel.degasperi at r3-gis.com
Wed Nov 12 07:25:00 PST 2008
Hello,
I would like to export a mapfile to sld using the following PHP/MapScript.
function ms_create_sld($map) {
for($i=0;$i<$map->numlayers;$i++) {
// - get Layer
$layer = $map->getLayer($i);
// generate the sld for that layer
$SLD = $layer->generateSLD();
// save sld to a file
$fp = fopen("sld/merano/".$layer->name."-sld.xml", "w+");
fputs($fp, $SLD);
fclose($fp);
}
}
Unfortunately it seems that OUTLINECOLOR is not exported, see following
mapfile-fragment. It seems that this happens only with POINT Layers.
I'm using MapServer 5.0.3 on Centos5. Is there something I am doing wrong?
Regards Daniel
LAYER
NAME "tree"
GROUP "basic_map"
STATUS ON
CONNECTIONTYPE postgis
CONNECTION "user=foo password=foo dbname=foo host=foo"
DATA "the_geom FROM tree.tree_view USING UNIQUE tr_id USING SRID 32632"
TYPE POINT
DUMP TRUE ## REQUIRED for WFS
MINSCALE 0
## MAXSCALE 50000
FILTER "tr_date_end >= now() or tr_date_end is null"
PROJECTION
"init=epsg:32632" ##required per WFS
END
HEADER "/data/sites/wms/templates/header.html"
TEMPLATE "/data/sites/wms/templates/test.html"
FOOTER "/data/sites/wms/templates/footer.html"
CLASS
NAME "IT:Pianta|DE:Pflanze"
SYMBOL 'circle'
COLOR 0 200 0
* OUTLINECOLOR 0 100 0 # THIS IS NOT EXPORTED TO SLD*
SIZE 5
END
METADATA
"DESCRIPTION" "IT:Pianta|DE:Baum"
"WMS_SRS" "EPSG:32632"
"WMS_TITLE" "tree_pg"
"wms_feature_info_mime_type" "text/html"
"wfs_title" "tree" ## REQUIRED
"gml_featureid" "ID" ## REQUIRED
"gml_include_items" "tr_id,<text it="ar_name_1"
de="ar_name_2">,tr_code,<text it="sc_name_1"
de="sc_name_2">,tr_date_start,tr_diameter_trunk" ## Optional (serves
all attributes for layer)
"wms_sld_url" "http://192.168.0.18/wms/sld/merano/tree.sld"
END #METADATA
END #LAYER
--
Daniel Degasperi
Software Developer
daniel.degasperi at r3-gis.com
---------------------------
R3 GIS Srl
Via Johann Kravogl 2
I-39010 Merano - Sinigo (BZ)
Tel. +39 0473 494949
Fax. +39 0473 069902
Web http://www.r3-gis.com
-----------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20081112/9e00908d/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tree-sld.xml
Type: text/xml
Size: 867 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20081112/9e00908d/attachment.xml>
More information about the MapServer-users
mailing list