I need to prepare offline background data for my area of interest which is located around border between Czech Republic and Germany. I need to convert the OSM data to spatialite and then to use in QGIS as Google Maps like background.

I already have working method (from @Underdark) for how to convert OSM to spatialite DB and also the visual styles.

However I would like to avoid downloading OSM data for whole Europe - from Geofabrik.de it is about 21 GB.

Is it better to first somehow merge OSM files of Germany and Czech Republic or is it easier to perform Spatialite extraction (so would have smaller file and less data than for whole country) and then merge the Spatialite datasets?

3 Answers 3


You could do some processing before with osmconvert (http://wiki.openstreetmap.org/wiki/Osmconvert) or osmosis. Basically you cut the area you're interested (clip based on bbox) in from the two extracts, then merge the two resulting files to have a single file. Then you can convert this file in spatialite, probably faster than doing on the complete file!


osmconvert germany.pbf -b=13.977356,50.982641,13.491211,50.724286--complete-ways --complex-ways -o=german_part.pbf

osmconvert czech_republic.pbf -b=14.273987,50.809406,13.716431,50.593699 --complete-ways --complex-ways -o=czech_part.pbf

osmconvert german_part.pbf czech_part.pbf output.pbf


You can do this with the QGIS plugin QuickOSM. You can also grab the query from the QuickOSM-gui and use that for querying the Overpass-API (you just need to paste the XML to the editor and run the script..) which will allow you to export the search result as GeoJSON or osm-file.

See the last picture with a query comprising all OSM-Data within a given boundingbox, for which you can use your QGIS canvas extent of interest...

You could either put the bbox values manually to the query:

  <union into="_">
    <bbox-query e="11.3987853267" n="47.3097135942" s="47.1831024553" w="11.2006013124"/>
    <recurse type="up"/>
    <recurse type="down"/>
  <print mode="meta"/>

enter image description here

enter image description here


I would recommend splitting the Europe file, as opposed to trying to merge OSM files. Often the country extracts will have a slight buffer, so the Czech extract will include a bit of germany. I don't know how well various merging tools are at deduplicating that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.