In this blogpost we will have a deeper look into the first part of the automated script, called “osmconvert.bat”. In this batch file, the OSM data will be downloaded and converted for later use.

The OSM database is far from complete, but it is constantly being expanded. In addition, there is no resolution in the data and we can scale it to our desired size. For roads and rivers / lakes, the data is almost complete. What is missing most are buildings and landuse informations. More information on Wikipedia.


There are two ways of getting the OSM data that are required for the process. The first (and easiest) way is to let the script download all necessary data from the web using wget.

Don’t be afraid, you don’t have to piece together the source code yourself. In the finished program you select your desired Tiles and export the script: A simple batch file you just need to execute.

wget -O "osm/N39E008.osm" ",8,40,9);<;>;);out;"

wget -O "osm/N39E009.osm" ",9,40,10);<;>;);out;"

Let’s go through the lines bit by bit.

simple opens the program wget.exe, which needs to be in the same folder as the batch file.

-O <filename>
-O means output and the following part inside the quotation marks needs to be the relative or absolute path where the download will be saved.

The last part inside the other quotation marks is the url that we want to download using wget. We are using the overpass-api, which sends us simple OSM data.,8,40,9);<;>;);out;

Now let’s take a look at the url. We can define the area / data we want to download by giving a node and the coordinates (minimum latitude, minimum longitude, maximum latitude and maximum longitude). You can either download a seperate osm file for each Tile or a combined file, when the Tiles are adjacent. Note that some Tiles have very much informations and can be over 100 mb in size.


There is one problem with the overpass-api. When you try to download lots of requests, you will get the error code: “Too many requests”.

That’s why I added another option to download OSM data from the Geofabrik server. They offer lots of file, compressed and splitted in different continents, countries and even smaller regions.

You simply need to download your desired region as a *.osm.pbf file and save them inside your project in the osm folder (with the filename: “download.osm.pbf”).


In the next step, the complete osm file is converted and filtered into different files, each representing one map feature.

osmconvert osm/download.osm.pbf --complete-multipolygons --complete-ways -o=osm/output.o5m

osmfilter osm/output.o5m --verbose --keep="highway=motorway or highway=trunk" -o=QGIS/OsmData/highway.osm

osmfilter osm/output.o5m --verbose --keep="water=lake or water=reservoir or natural=water or landuse=reservoir or waterway=riverbank or waterway=canal or water=river" -o=QGIS/OsmData/water.osm

At the first command, we only store the data with the tag “highway=motorway” and “highway=trunk”. These are the biggest roads in each country.

The second command saves a few tags at once. For example everything with “water=lake” or “water=river”. All these things represents water bodies, which will use the same layer in the WorldPainter Script.


Here is also the first point for customization. You want a special map, for example a post modern map with dryed up lakes? Remove the words “water=lake” from the “osmscript.txt” file (It’s the base code for the script generation. If you did something wrong, just delete the file, it will be generated again with the standard code). Or a medieval world, where canals weren’t build at this time? Remove “water=reservoir” and “waterway=canal”. Or maybe in the future there are new information in the OSM data. Just add them and you will get completly new map features.