1

I need to extract a large area from OSM to import it into my local PostGIS-DB (using osm2pgsql).

For smaller areas I was using http://extract.bbbike.org/ to download OSM-XML-Data. It's possible to select the area by rectangle or by polygon. The maximum size of extract can be 512MB. But now I need to download a larger area - maybe about 1GB - too large for bbbike.org.

QuickOSM seems to be also no option, cause of the size of the area.

The area of interest is a 30km buffer of a 900km-track and runs across 2 Countrys. I could download both Countrys, but that would by a way too much data for my available resources.

How can I get to my data?

  • 2
    You can use osmconvert to extract the relevant area before importing your data to PostGIS. – Mesa Feb 15 '18 at 10:11
  • 2
    Check if download.geofabrik.de has some suitable extract. – mmd Feb 15 '18 at 17:38
  • osmosis can handle this too – RutgerH Feb 17 '18 at 13:29
4

Thanks to Mesa's and mdd's comment I found that sollution:

  1. Download the whole dataset from download.geofabrik.de (or anywhere else)
  2. Create a polygon for clipping (in my case a buffer of a line)
  3. Save the polygon as *.poly using QGIS and the Export OSM Poly plugin (important: the CRS of the polygon must be the same of the OSM dataset - EPSG:4326)
  4. Using osmconvert to clip the osm-Dataset with the *.poly-polygon from step 3. (for Linux users: you have to install osmctools first!)
  5. Done!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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