render large regions (like entire europe) from osm-data to png files

Hi :slight_smile:

I’m really not sure whether this post will be of interest for anyone out there, if not, hopefully no one will be annoyed about it all-too-much…:wink:

It’s more than a year ago that we were faced with the problem of rendering a png image showing a simple map of europe (Mercator projection) from the europe.osm.bz2 data file.
The target map should only contain coastlines and administrative boundaries (boundaries between countries (oehm…that was admin-level … 2(?)))
In doing so we found ourselves under a number of (practical) constraints. Three among those seemed to complicate our plan particularly:

  1. the resulting map had to be free of any artifacts. That’s why we didn’t dare to rely on methods based on splitting the data in “tiles” which later on would have to be (re-) assembled (the classical divide and conquer approach). However, our mistrust of such techniques may have been unjustified, although there were serious arguments I can’t recall in all clarity :wink:

  2. we decided to use osmarender, rendering an SVG and then transforming the SVG into a png image using inkscape (to be honest:I can’t exactly remember why).
    The svg needed to be small enough for that inkscape could do the job.

  3. we had limited hardware resources (average consumer hardware). Nevertheless the transformer should terminate before we became gray-haired…

The solution turned out to be rather simple (and the transformer, a small java program, …ok… it’s more a draft or a working prototype resp. - not a technically mature piece of software…, was written in a couple of hours. Despite its sketchity it was sufficient for our purposes).
We utilized that the target png possesses a grid (discrete pixel-) structure. In relation to the geographic dimension of europe long sequences of nodes along ways will fall into one and the same pixel in the target map image (png). So size of the source data could be reduced significantly without loss of information regarding the target structure. The degree of compression could even be increased further by reducing repeating subsequences along ways or possibly also among pairs (or sets…?->needs further examination) of ways. This, of course would be a bit less trivial and was practically not mandatory in our case. It could nevertheless be funny to implement this extension, however I don’t find the time for any
spare-time-projects at the moment :(. Maybe someone else is interested in the draft. If so: it’s yours :). The java source code can be downloaded here (it should be easy to understand, otherwise please don’t hesitate to contact me: martin.beckmann at wecanbook.de):
www.wecanbook.com/openstreetmapcommunity/wcbOSMRasterTransformer.zip
It reads from stdin so you’ll need bzcat or a similar command line tool… in the zip file an example output png is contained (central america).
all in all that’s just a little thing, I know…
best wishes to all of you :slight_smile: … martin

When no sufficient answers are written here to this special questions, try to ask again in the more frequented German subforum, as you look like a German speaking guy, are you?

Greets, Stephan