[OSM-talk] Rendering collisions in Mapnik

David Earl david at frankieandshadow.com
Thu May 29 17:36:20 BST 2008


I understand Mapnik has some caption collision avoidance built in, yes? 
Can someone explain what the rules are?

I ask because of this:
http://www.openstreetmap.org/?lat=52.1988&lon=0.4122&zoom=14&layers=B00FF

You can see there's a series of small villages, Saxon Street, Little 
Ditton, Woodditton, Stetchworth dotted over the area, but the name of 
probably the most significant is missing, which is rather disturbing as 
it gives an incorrect sense of incompleteness.

If you follow the road South West and then West from Stetchworth you 
come to a crossroads with the B1061. A point very close to that 
crossroads is Dullingham (as you can see if you either zoom out or zoom 
in one level).

I'm guessing that the collision detection is giving preference to the 
B1061 label.

Is this a deliberate precedence, or is it just which is seen first?

If the latter, is it possible to implement a precedence. I think place 
names are considerably more important - especially if other place names 
are present - than the road numbers, which will generally be repeated 
anyway. And in general to have a hierarchy of which is rendered by 
precedence - e.g. the name of a primary road is more important than a 
tertiary and so on.

Also for points, what about moving the caption slightly. Are you using 
some kind of grid of cells to decide whether an area of map is occupied 
by a caption? If so rather than abandoning it at first go, might it be 
possibly to try neighbouring cells in an outwardly expanding spiral up 
to some limit deemed too far? In this case it wouldn't matter a jot if 
the name Dullingham was shown 1mm further south.

David




More information about the talk mailing list