David,
From a quick test I did locally using latest MapServer, I don;t see any
particular issues with your sld. I was able to generate the labels as
expected. Note that the anchor position is only used when labeling point
features.
Are each polygon formed with one shape or could one polygon be formed by
several adjacent shapes? You can also check the log files and see what
your layer looks like after the sld is applied: add something like this
in your map file for example:
CONFIG "MS_ERRORFILE" "f:/logs/my_log_file.log"
DEBUG 5
regards,
David Alda Fernandez de Lezea wrote:
Hi,
I've got a SLD that I apply to a polygon layer and I want to add a
label to identify those polygons. I manage to add the the labels but
my problem is that the labels are repeated a lot of times into the
polygons and furthermore they don't appear on the centroif of my
polygon. Here is my TextSymbolizer tag:
<TextSymbolizer>
<sld:MinScaleDenominator>3000</sld:MinScaleDenominator>
<sld:MaxScaleDenominator>5000</sld:MaxScaleDenominator>
<Label>
<ogc:PropertyName>MUNICIPIO</ogc:PropertyName>
</Label>
<Font>
<CssParameter name="font-family">Arial</CssParameter>
<CssParameter name="font-weight">bold</CssParameter>
<CssParameter name="font-size">8</CssParameter>
</Font>
<!-- this centers the label on the polygon's centroid-->
<LabelPlacement>
<PointPlacement>
<AnchorPoint>
<AnchorPointX>0.5</AnchorPointX>
<AnchorPointY>0.5</AnchorPointY>
</AnchorPoint>
</PointPlacement>
</LabelPlacement>
<!-- make the label easy to read-->
<Halo>
<Radius>
<ogc:Literal>2</ogc:Literal>
</Radius>
<Fill>
<CssParameter name="fill">#FFFFFF</CssParameter>
<CssParameter name="fill-opacity">0.85</CssParameter>
</Fill>
</Halo>
<Fill>
<CssParameter name="fill">#000000</CssParameter>
</Fill>
<!-- This labels each name only once, not every shape with
that name -->
<VendorOption name="group">true</VendorOption>
</TextSymbolizer>
Un saludo,
··················································································
*David Alda Fernández de Lezea*
Lurralde eta Biodibertsitate Saila / Dpto. de Territorio y Biodiversidad
*IKT*
Granja Modelo s/n · 01192 · Arkaute (Araba)
··················································································
Tlfnos.: 945-00-32-95 Fax: 945-00.32.90
··················································································
email: da...@ikt.es
<mailto:da...@ikt.es> web: www.ikt.es
<http://www.ikt.es/>
··················································································
------------------------------------------------------------------------
_______________________________________________
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users
--
----------------------------------------------------------------
Assefa Yewondwossen
Software Analyst
Email: ass...@dmsolutions.ca
http://www.dmsolutions.ca/
Phone: (613) 565-5056 (ext 14)
Fax: (613) 565-0925
----------------------------------------------------------------
_______________________________________________
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users