Add PointOnLine symbolizer #788

artemp opened this Issue Oct 11, 2011 · 4 comments


None yet

3 participants

artemp commented Oct 11, 2011

Mapnik should be able to draw icon for point turned to be in same direction as direction of way on which that point lies.

This is needed to render highway crossings, power towers and other.

See crossings on Osmarender:

artemp commented Oct 11, 2011

[springmeyer] are you sure those crossing are not actual data? (e.g. perpendicular lines draw in place)

artemp commented Oct 11, 2011

This is now with Mapnik 2.1.0 possible since the SVG transform can be parametrized. The syntax is following:

  <Style name="crossings">
        <PointSymbolizer file="&symbols;/SVG/crossing.svg" allow-overlap="true" ignore-placement="true" transform="rotate([angle])" placement="interior"/>

  <Layer name="crossings" status="on" srs="&osm2pgsql_projection;">
        <Parameter name="table">
        select distinct on (p.way) p.way as way,
          l.highway as int_tc_type,
          degrees( ST_azimuth(coalesce(ST_Line_Interpolate_Point(l.way, ST_line_locate_point(l.way,p.way) * 0.99), p.way),
                              coalesce(ST_Line_Interpolate_Point(l.way, (1 - (1 - ST_line_locate_point(l.way,p.way)) * 0.99)), p.way))) as angle

         from &prefix;_point p
         join &prefix;_line l
          on ST_DWithin(p.way,l.way,&dwithin_node_way;)
         join (values
         ) as v (highway,prio)
          on v.highway=l.highway
         where p.highway='crossing'
         order by p.way,v.prio
       ) as crossing

(The PSQL query is not very elegant, but it is the best I was able to make.)
The result can be seen on

To bring this feature for other users, it should be documented, even some syntax shortcuts would be nice.

talaj commented Apr 21, 2015

This should be solved by #2621.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment