Monday 15 May 2017

openstreetmap - Extract large area from OSM


I'm trying to export all objects of East Kazakhstan region(as in image) from OSM file into separate pbf/osm file. What I'm trying to do is extract data from kazakhstan-latest.osm.pbf file by using osmconvert and osmfilter commands, but seems like it doesn't do what I would like to get.


After running the command:


./osmfilter kaz.o5m --verbose --keep="admin_level=4 and name=Восточно-Казахстанская\ область" -o=east2.osm


I see that my extracted file is only 3.1 Mb which is definitely small for such area.


-rw------- 1 sp sp 3.1M Aug 31 16:45 east2.osm

East Kazakhstan



Answer



You ask osmfilter to keep everything that has admin_level 4 and a certain name. That is NOT everything inside that border line which you intend to get.


Instead, use osmconvert to clip to the region of interest from the .pbf file:


http://wiki.openstreetmap.org/wiki/Osmconvert#Clipping_based_on_a_Polygon


You need to convert the border (which you already have filtered) to polygon style with one of the softwares listed at http://wiki.openstreetmap.org/wiki/Osmosis/Polygon_Filter_File_Format#Converting_to.2Ffrom_POLY_format .


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...