TransWikia.com

Exclude geographic extent of an OSM file

Geographic Information Systems Asked on December 13, 2020

Osmium and Osmosis command tools have the capability of extracting a geographic extent from an OSM file.

osmosis 
--read-xml test.osm --tee 1
--bounding-box left=15 top=46 --write-xml extract_test.osm

osmium extract -p city.geojson test.pbf -o extract_test.pbf

What I need is to extract region from an OSM file like a city and after some edits, merge it with the OSM file with the hole (excluded the city region). How can I exclude or clip a geographic extent from original file?

One Answer

GeoJSON polygons are allowed to have holes, and Osmium does in fact support this.

So you could construct a polygon where ...

  • ... the outer ring is large enough to contain all the data in the original file
  • ... the inner ring is the boundary of the city you want to exclude.

Running osmium extract with that polygon as the -p parameter would remove data inside the inner ring and yield the desired result.

Answered by Tordanik on December 13, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP