[mapserver-users] Re: Custom Symbology using C# MapScript and SLDs

Pat B barnhart.pat at gmail.com
Fri Mar 19 00:30:39 EDT 2010


I've managed to get the external graphic symbols working by creating a web
accessible folder for temp images and adding the following line to the code. 
This is mentioned in the mapscript documentation under the polygon
symbolizer but it also applies to points.

       map.setMetaData("WMS_SLD_SYMBOL_URL", "http://<url of web accessible
virtual dir>/");

The well known symbols seem to be limited to square and circle on my setup
but I've got versions of the others in my .sym anyway.

The truetype and vector symbols however, do not appear to be supported by
mapscript's generateSLD().  It'll put them in an exported mapfile and load
them into a symbol set or whatever you want to do on the mapscript side but
not write them to an sld (unless I'm missing something).  I saw an open
ticket regarding polygon symbols in my wanderings that seems to back this
up.  Anybody know for sure?  Mapserver reads them out of the sld with no
problem, it's getting them into the sld that's tricky.

I hacked my way around it by putting in a dummy 'square' well known name
symbol and then doing a loop to replace 'square' in the sld string with the
name of the truetype or vector symbol for the various classes and layers. 
Gets the job done but...  Well anyway, if anybody runs across this and knows
a better way I'm all ears.

Also, in the code from the first post, no need to load an existing
map/layer, just make an empty map file and build it from scratch (new
mapObj(null);) so the only stuff in there is for the customized layers. 
That way you don't have to worry about pre existing styles and classes from
the mapfile although you do need to set the locations of the fonts, symbols,
etc in the blank mapObj.

So, hallelujah, if you're going down this road or doing something similar I
hope this helps.   


-- 
View this message in context: http://n2.nabble.com/Custom-Symbology-using-C-MapScript-and-SLDs-tp4744442p4761106.html
Sent from the Mapserver - User mailing list archive at Nabble.com.


More information about the mapserver-users mailing list