[OSM-talk] Mapnik Lowzoom TIles - proof of concept

Christoph Hormann chris_hormann at gmx.de
Sun Jun 30 16:26:41 UTC 2013

On Sunday 30 June 2013, Frederik Ramm wrote:
> * To produce the "raw" tiles for z-1 (which are never visible but
> only used as an input for z-2 tiles later), I not only downscale the
> tiles on z, but after that, use ImageMagick's "Compose" function with
> a mode of "Darken" to repeat the placement of downscaled tiles three
> times, with an offset of (0,1), (1,0) and (1,1). This step is crucial
> because otherwise the roads would thin out to a "hint of road" after
> 2 scale-down steps, but at the same time this is also resposible for
> the darkening of tiles as you get to lower zooms. (The "Darken"
> method chooses the darker of the two inputs.)

I see - when you do this just one zoom level above you will likely get 
significant aliasing (the offset operations introduce 2x2 pixel 
structures which are then resized to half the size).  In my experience 
such morphological tricks work best with at least two zoom levels 
difference between processing and target grid:

convert z9.png \( +clone -morphology Erode Disk:2.5 \) \
-compose Darken -composite -scale 12.5% z6.png

> I would be happy to hear ideas about how to do this differently, and
> try them out.

If you want to emphasize the roads it would probably be best to render 
them separately at z=9 to be able to process them in a different way.  
This would double the ressources required of course.

You can also try something like:

convert -sigmoidal-contrast 15,50% -scale 12.5% \
+sigmoidal-contrast 15,50% z9.png z6.png

this will however somewhat distort the colors when you do it in RGB.


Christoph Hormann

More information about the talk mailing list