Categorygithub.com/twpayne/osm-extract
repositorypackage
0.0.0-20240620092102-e69a0aa46642
Repository: https://github.com/twpayne/osm-extract.git
Documentation: pkg.go.dev

# README

osm-extract

osm-extract extracts features from OpenStreetMap PBF files as GeoJSON.

Features

  • Reads .osm.pbf files from local disk, no need to run an Overpass API server.
  • Preserves OpenStreetMap tags as GeoJSON properties.
  • Extremely fast, thanks to github.com/paulmach/osm.
  • Optionally polygonizes ways and relations, thanks to GEOS.
  • Optionally unions all features into a single feature.

Install

$ go install github.com/twpayne/osm-extract@latest

Example

Extract the administrative boundaries of the Isle of Man as a polygon:

$ osm-extract -i testdata/isle-of-man-latest.osm.pbf -type=relation -tags=ISO3166-1=IM,admin_level=2 -polygonize
$ osm-extract -i testdata/isle-of-man-latest.osm.pbf -type=relation -tags=admin_level=6 -polygonize -union

License

MIT