This is a static archive of our old OpenStreetMap Help Site. Please post any new questions and answers at community.osm.org.

How does Mapnik handle overlap problem during rendering dense dataset

1

Hi:

Suppose there are so many features(say they are pois) in a single tile, then how does osm handle the overlap problem?

I know osm use mapnik as the render engine, and we can set some filters during the rendering at different zoom level, but how about the filter lost the effects?

For example, in a specified zooom, even we use the filter, there are still some features close to each other, if render all of them, there must be some overlap, so how does osm handle this suitation?

asked 21 May '14, 06:58

hguser's gravatar image

hguser
36336
accept rate: 0%

edited 21 May '14, 08:21

scai's gravatar image

scai ♦
33.3k21309459


One Answer:

3

Mapnik, by default, does not draw overlapping features for icons and text symbolizers. So the features in the first layer are drawn first, one-by-one, and if there is no space remaining then they are not drawn.

This means that the order of the layers, and the order of the features within the layers, are important.

answered 21 May '14, 11:38

Andy%20Allan's gravatar image

Andy Allan
12.5k23128153
accept rate: 28%

1

Do you mean that mapnik draw all features in layer A, and it will process overlap for this layer(A), once it start to render the next layer(B),for a given feature from B,mapnik will detect if the place have been taken up by other rendered feature, if not , then render this feature? If so, does it mean that the conflict(overlap) detect just happen between features in the same layer?

(22 May '14, 12:00) hguser

By default mapnik has just one collision detection cache, which records the placements across all the layers (so that e.g. text in the roads layer avoids text from points of interest). It's possible to reset the cache between layers, but that usually leads to poor results.

(28 May '14, 09:23) Andy Allan

Source code available on GitHub .