This is a static archive of our old OpenStreetMap Help Site. Please post any new questions and answers at community.osm.org.

Export data with polygon selection instead of bounding points

0

Hi all,

I'm working to evaluate the transportation condition of an arbitrary site, but these sites do not usually fall into a rectangular space, so that using a bounding box to export data from OpenStreetMap won't give a precise geometry. Is there any option that I can export data with polygon selection, or do it offline in a clean way?

Thanks in advance for your help, Jiachen

asked 16 Aug '21, 05:00

JiachenLu's gravatar image

JiachenLu
11112
accept rate: 0%


2 Answers:

1

My favorite tool for extracting data from osm.pbf is OSMIUM https://docs.osmcode.org/osmium/latest/osmium-extract.html And next question is where to get the polygons with boundaries? https://osm-boundaries.com/Map of course!

answered 16 Aug '21, 13:10

az09's gravatar image

az09
261
accept rate: 0%

Thanks a lot! It worked like a charm

(17 Aug '21, 13:49) JiachenLu

0

For relatively small scale usage I would use overpass or overpass-turbo, you can describe a bounding polygon as a series of co-ordinate pairs, so probably most useful if you are using the same poly again & again or it has a relatively small number of nodes. If the area is already defined in OSM then this can be used directly in overpass queries (see the documentation for examples).

I normally don't recommend Osmium directly because on some platforms there is quite a long dependency chain for compilation, and therefore it's not necessarily the tool to fix a little problem if not already in use. Most OSM ETL-style tools (osmconvert, osmosis, osmium-tool) will take a polygon file and allow you to clip a larger dataset by that polygon file. Both QGIS & JOSM allow the creation of OSM style polygon files directly. Persnally I find osmconvert satisfactory for this type of task.

answered 18 Aug '21, 13:04

SK53's gravatar image

SK53 ♦
28.1k48268433
accept rate: 22%

Source code available on GitHub .