Wednesday, 11 March 2015

openstreetmap - Extract OSM data (xml) from large polygon (up to 1GB of data)



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?



Answer



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!


No comments:

Post a Comment