On Thu, 2008-07-31 at 14:40 -0500, Brian Peschel wrote:
> Thanks to Dane and Jon for your input.  Turns out to be a different problem.
> 
> I made some other changes.  I am now drawing 2 features, one symbol and 
> one line.  I setup a styles with the following rules:
> <Rule>
>   <Filter>[mapnik:geometry] = '1' and [point_symbol] = 'cemetery'</Filter>
>   <PointSymbolizer file="$MSLHOME/syms/cemetery.png" type="png" 
> width="20" height="20" allow_overlap="true"/>
>   <TextSymbolizer name="name" face_name="DejaVu Sans Bold" size="9" 
> fill="#000" halo_radius="1" placement="point" dy="-20"/>
> </Rule>
> <Rule>
>   <Filter>[highway] = 'unclassified'</Filter>
>   <LineSymbolizer>
>     <CssParameter name="stroke">#999</CssParameter>
>     <CssParameter name="stroke-width">11</CssParameter>
>     <CssParameter name="stroke-linejoin">round</CssParameter>
>     <CssParameter name="stroke-linecap">round</CssParameter>
>   </LineSymbolizer>
> </Rule>
> <Rule>
>   <Filter>[highway] = 'unclassified'</Filter>
>   <LineSymbolizer>
>     <CssParameter name="stroke">#fff</CssParameter>
>     <CssParameter name="stroke-width">9.4</CssParameter>
>     <CssParameter name="stroke-linejoin">round</CssParameter>
>     <CssParameter name="stroke-linecap">round</CssParameter>
>   </LineSymbolizer>
> </Rule>
> <Rule>
>   <Filter>[mapnik:geometry] = '2'</Filter>
>   <TextSymbolizer name="name" face_name="DejaVu Sans Book" size="9" 
> fill="#000" halo_radius="1" placement="line"/>
> </Rule>
> 
> I have confirmed the attributes are setup properly for the two 
> features.  I see the label for the line but not for the symbol (point 
> feature) if I draw the symbol.  However, if I change the label line:
> <TextSymbolizer name="name" face_name="DejaVu Sans Bold" size="9" 
> fill="#000" halo_radius="1" placement="point" dy="-20"/>
> It will not draw the label if the symbol is there or not there.  If I 
> change this to:
> <TextSymbolizer name="name" face_name="DejaVu Sans Bold" size="9" 
> fill="#000" halo_radius="1" placement="point" dy="20"/>
> Then is renders properly (positive dy rather than negative dy) with the 
> label below the symbol.
> 
> If I take out the dy= part it only draw the label if I don't draw the 
> symbol.
> 
> I assumed a negative dy would move the label below the symbol and a 
> positive dy would move the label above the symbol.  The Open Street Map 
> XML file uses both positive and negative dy values.

For Mapnik the (0,0) co-ordinate is in the top left corner and are
postive in the down/right direction. Positive dy values move the label
downwards. As you say both positive and negative offsets work for the
OSM style (e.g. station names are above the symbol with a -ve offset,
pub names are below with +ve offset[1]).

I would try increasing the dy to larger values +-40 and make sure the
label is nowhere near the edge of what you are rendering. I think the
label will be dropped if it even slightly overlaps with the edge of the
rendered area. The OSM tiles get rendered with a fairly large off-tile
gutter to avoid losing names on tile boundaries.

> Does this sound like a bug or user error?  I would like the ability to 
> specify the label above the symbol in some cases (if possible).

> I am also not sure what the wrap_width means.  Setting it to 0 seems to 
> have no effect.  I am guessing it needs to find a space in the label 
> before it wraps the text.

wrap_width=0 is specifying that you do not want any wrapping. A non zero
value will wrap at the first space that appears beyond the specified
wrap width. The width value is based on the total pixel width of the
rendered font, not the number of characters.

        Jon


1: http://www.openstreetmap.org/?lat=51.7508&lon=-0.32869&zoom=17&layers=B00FTF


_______________________________________________
Mapnik-users mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/mapnik-users

Reply via email to