Hi all,
I ended up using a slightly different approach to the one-way street
arrows and thought I'd share it.
New York City's street centerline file uses a field (trafdir) to
indicate one-way street segments. For one-way streets, it can be:
'W' - One-way in the direction of ascending street numbers ("with")
'A' - One-way in the opposite direction of ascending street numbers ("against")
I used text symbolizers (and the special characters that are built-in
to many fonts) to specify that labels should use a right arrow
character for streets with a 'W' and a left arrow character for
streets with an 'A'. Because the text symbolizer takes care of
aligning the font with the street, I didn't have to worry about
figuring out the proper rotation. (Using a single rotation for each
street segment is also a problem if you have curved streets and this
method solves that, too!)
Here's a snippet from the SLD (it's basically the same for both the A
and W case so I didn't include them both -- only the filter and hex
character literal differs):
<Rule>
<ogc:Filter>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>trafdir</ogc:PropertyName>
<ogc:Literal>W</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:Filter>
<TextSymbolizer>
<Label>
<ogc:Literal>→</ogc:Literal>
</Label>
<Font>
<CssParameter name="font-family">Lucida Sans</CssParameter>
<CssParameter name="font-style">Normal</CssParameter>
<CssParameter name="font-size">18</CssParameter>
<CssParameter name="font-weight">Normal</CssParameter>
</Font>
<LabelPlacement>
<LinePlacement>
<PerpendicularOffset>-2</PerpendicularOffset> <!-- This was
because the arrows were slightly off-center -->
</LinePlacement>
</LabelPlacement>
<Fill>
<CssParameter name="fill">#a4bdc5</CssParameter>
<CssParameter name="fill-opacity">1.0</CssParameter>
</Fill>
</TextSymbolizer>
</Rule>
I've also attached a screen shot. Probably the most challenging thing
was getting the correct balance between street name labels and arrow
labels (which are on two different layers). I became intimately
familiar with all the new labeling options and made use of
spaceAround, maxDisplacement, and Repeat to get something close to the
right balance.
Thanks,
Jordan
On Mon, Jan 26, 2009 at 2:01 AM, Kris Geusebroek <kgeusebroek@anonymised.com> wrote:
Hi Jordan,
If you know the angle in which the street is going you can use the
following code snippet in your TextSymbolizer of your SLD
<LabelPlacement>
<PointPlacement>
<Rotation>
<ogc:Sub>
<ogc:Literal>360.0</ogc:Literal>
<ogc:PropertyName>ROTATION_ANGLE</ogc:PropertyName>
</ogc:Sub>
</Rotation>
</PointPlacement>
</LabelPlacement>
Or something similar.
But you have to have a column in your database where the rotation angle
is specified this way.
Hope this is of use to you
Regards
Kris
-----Original Message-----
From: Jordan Anderson [mailto:jordandrsn@anonymised.com]
Sent: Friday, January 23, 2009 7:31 PM
To: geoserver-users@lists.sourceforge.net
Subject: [Geoserver-users] One-way street directional arrows using SLD
Hi all,
I searched the mailing list archives and may have missed the answer so
I apologize if someone has addressed this already, but has anyone
figured out a way to correctly print one-way arrows on streets? If so,
I'd be interested in hearing how you did it.
Thanks,
Jordan
------------------------------------------------------------------------
------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users
