[Chameleon] Dynamic SLD and TextSymbolizer
Pascoe,Tim [Burlington]
Tim.Pascoe at ec.gc.ca
Tue Oct 12 09:03:03 EDT 2004
I've been working on a way to incorporate a dynamically generated SLD, which I am using to provide custom filter capabilities on a point layer. I've managed to get a simple widget developed which passes a form variable to the SLD script file, permitting a dynamic filter value to be passed. It works great, but now I'm having trouble getting the TextSymbolizer in the SLD to correctly format the labels.
The TextSymbolizer will change the color of the labels, but not the font or the point size - the font is installed with Mapserver in the correct directory. The map file layer, and appropriate SLD script is below.
Thanks for any suggestions - I'm sure I'm missing something simple......
Here is the extract of the TextSymbolizer script:
$strScriptOut = $strScriptOut . " <TextSymbolizer>";
$strScriptOut = $strScriptOut . " <Geometry>";
$strScriptOut = $strScriptOut . " <PropertyName>site</PropertyName>";
$strScriptOut = $strScriptOut . " </Geometry>";
$strScriptOut = $strScriptOut . " <Label>site</Label>";
$strScriptOut = $strScriptOut . " <Font>";
$strScriptOut = $strScriptOut . " <CssParameter name='font-family'>vera</CssParameter>";
$strScriptOut = $strScriptOut . " <CssParameter name='font-style'>normal</CssParameter>";
$strScriptOut = $strScriptOut . " <CssParameter name='font-weight'>normal</CssParameter>";
$strScriptOut = $strScriptOut . " <CssParameter name='font-size'>8</CssParameter>";
$strScriptOut = $strScriptOut . " </Font>";
$strScriptOut = $strScriptOut . " <Fill>";
$strScriptOut = $strScriptOut . " <CssParameter name='fill'>#000000</CssParameter>";
$strScriptOut = $strScriptOut . " </Fill>";
$strScriptOut = $strScriptOut . " <LabelPlacement>";
$strScriptOut = $strScriptOut . " <PointPlacement>";
$strScriptOut = $strScriptOut . " <AnchorPoint>";
$strScriptOut = $strScriptOut . " <AnchorPointX>0.5</AnchorPointX>";
$strScriptOut = $strScriptOut . " <AnchorPointY>0.5</AnchorPointY>";
$strScriptOut = $strScriptOut . " </AnchorPoint>";
$strScriptOut = $strScriptOut . " <Displacement>";
$strScriptOut = $strScriptOut . " <DisplacementX>20</DisplacementX>";
$strScriptOut = $strScriptOut . " <DisplacementY>10</DisplacementY>";
$strScriptOut = $strScriptOut . " </Displacement>";
$strScriptOut = $strScriptOut . " <Rotation>20</Rotation>";
$strScriptOut = $strScriptOut . " </PointPlacement>";
$strScriptOut = $strScriptOut . " </LabelPlacement>";
$strScriptOut = $strScriptOut . " <Halo />";
$strScriptOut = $strScriptOut . " </TextSymbolizer>";
Here is the Mapfile layer:
LAYER
NAME "CABINPoints"
GROUP "Sample Points"
STATUS ON
TYPE RASTER
TOLERANCE 5
TOLERANCEUNITS PIXELS
TEMPLATE "tt.html"
CONNECTIONTYPE WMS
CONNECTION "http://localhost/scripts/mapserv.exe?map=C:/Documents%20and%20Settings/TimP/My%20Documents/CABIN/Maps/map/pointswms.map"
METADATA
"wms_onlineresource" "http://localhost/scripts/mapserv.exe?"
"wms_sld_url" ""
"wms_title" "CABIN Points test layer"
"wms_abstract" "Test Access to CABIN SQL-Server Database on ECBURAS1"
"wms_srs" "EPSG:42304"
"wms_name" "CABINPoints" # Eventually change this to the name of the Project being mapped??
"wms_formatlist" "image/png,image/gif,image/jpeg,image/wbmp"
"wms_format" "image/png"
"selected" "0"
"wms_server_version" "1.1.1"
"wms_title" "Site Location"
END
LABELITEM "site"
CLASS
name 'CABINPoints'
LABEL
COLOR 0 0 0
TYPE TRUETYPE
FONT fritqat
SIZE 8
POSITION LR
END
END
PROJECTION
"init=epsg:4326"
END
DUMP TRUE
END
Timothy Pascoe
Environment Canada / Environnement Canada
Canada Centre for Inland Waters / Centre Canadien des Eaux Intérieures
867 Lakeshore Road / 867, chemin Lakeshore
Burlington, Ontario / Burlington (Ontario)
L7R 4A6
Tel/Tél: (905) 336-6239
Fax/Téléc: (905) 336-4699
E-mail/C. élec: tim.pascoe at ec.gc.ca
Government of Canada/Gouvernement du Canada
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/chameleon/attachments/20041012/9713be6f/attachment-0001.htm
More information about the Chameleon
mailing list