Is there a way for Mapnik to render a symbol at every junction? I can't find an obvious rule. I don't mean each node along a line - just where two lines properly intersect at a junction, on the same level with a joining node (i.e. not say at a bridge). Mapnik seems to have
but that will presumably give me every node, not purely the junctions. I'm trying to create a rendering showing where there are proper junctions, not things which appear to be junctions but aren't actually connected properly. (I'm aware that there are great tools like KeepRight for this, but I'm working on custom data that needs such a debugging layer.) asked 21 Apr '16, 12:54 fooquency |
This is not a question of Mapnik being able to do something; the question is whether you can get your data source to compute these locations. (Mapnik's responsibility would then consist of placing an icon there, no more.) If the data comes from shape files then you're out of luck since there's no geo processing available. If the data comes from a PostGIS database then you could mark all intersections between two bits of road like this:
or substitute your own table and attributes instead of You can correct for some of that by adding stuff like In the OSM world you could get perfect results by evaluating the planet_osm_ways table which is generated when you run osm2pgsql with answered 21 Apr '16, 13:09 Frederik Ramm ♦ 1
You could probably extend this slightly by, after the intersection test on the lines, take the sets of vertices in the linestrings (st_dumppoints) and see if the sets include a common member. That will still have some false positives where OSM ways have independent nodes with identical coordinates, but at least remove almost all the bridges and tunnels where nodes aren't coincident.
(21 Apr '16, 14:26)
Andy Allan
Thanks, Frederik and Andy - this is most useful.
(21 Apr '16, 17:47)
fooquency
|
I recently put together a little tool to identify junctions, defined as "any node with more than two highways calling at it". It takes an .osm.pbf as input, and outputs a CSV of lat, lon, and junction type (a compound string enumerating the highway values). It may not slot into your workflow, and it almost certainly requires some tweaking to suit, but you may find it useful: https://github.com/systemed/intersector answered 21 Apr '16, 18:08 Richard ♦ |