labeling with SLDs in MapServer

Bart van den Eijnden (OSGIS) bartvde at XS4ALL.NL
Sat Apr 1 08:37:57 PST 2006


Hi Laura,

we use this functionality quite often, but I don't have access to the 
intranet Wiki here so I cannot paste an example.

I'll try to do that on Monday.

Best regards,
Bart

Laura Díaz wrote:

> Hi all,
> i am trying to label a layer i have defined in my map file, it is a 
> point shapefile layer, the SLD i am using is as follows:
> <StyledLayerDescriptor>
>                 <NamedLayer>
>                                 <Name>hojas_label</Name>
>                                 <UserStyle>
>                                     
> <Name>default:hojas_label:COD10000</Name>
>                                     <IsDefault>1</IsDefault>
>                                     <FeatureTypeStyle>
>                                     <Rule>
>                                                 <Name>labels</Name>
>                                                 <TextSymbolizer>
>                                                     <Label>
>                                                                 <ogc:PropertyName>HOJAS10_ID 
> </ogc:PropertyName>
>                                                     </Label>
>                                                                 <Font>
>                                                                 <CssParameter 
> name="font-family">Serif</CssParameter>
>                                                                 <CssParameter 
> name="font-style">normal</CssParameter>
>                                                                 <CssParameter 
> name="font-weight">normal</CssParameter>
>                                                                 <CssParameter 
> name="font-size">12</CssParameter>
>                                                                 <CssParameter 
> name="font-color">#000000</CssParameter>
>                                                                 </Font>                                                   
>                                                                     
> <LabelPlacement>                                                                  
>
>                                                                                 <LinePlacement>
>                                                                                 <PerpendicularOffset>above</PerpendicularOffset>
>                                                                                 <LineWidth>2.5</LineWidth>
>                                                                                 <Gap>5</Gap>
>                                                                                 </LinePlacement>
>                                                                     
> </LabelPlacement>
>                                                 </TextSymbolizer>
>                                     </Rule>
>                                     </FeatureTypeStyle>
>                                 </UserStyle>
>                 </NamedLayer>
> </StyledLayerDescriptor>
>
> When i request a GetMap with this layer and using this SLD i get the 
> message from Mapserver:
> <ServiceExceptionReport version="1.1.1">
> <ServiceException>
> msDrawMap(): Image handling error. Failed to draw layer named 
> 'hojas_label'.
> msDBFGetItemIndex(): DBASE file error. Item 'PropertyName' not found.
> </ServiceException>
> </ServiceExceptionReport>
> i´ve checked out the name of the field i want to label, and it is 
> correct, actually i did try with all the fields and i have the same 
> problem, the layer is good as well because i can visualize it if i 
> just don't use this SLD....
> Any ideas?
>
> thanks in advance,
>
> Laura



-- 
Bart van den Eijnden
OSGIS, Open Source GIS
http://www.osgis.nl



More information about the MapServer-users mailing list