Extract a geographic region by the given [b]ounding box

osmium

  • Multipurpose tool for handling OpenStreetMap (OSM) files.
    More information: <https://osmcode.org/osmium-tool/manual>.
  • Trick copyright: tl;dr; <https://github.com/tldr-pages/tldr>

osmium extract -b {{min_longitude}},{{min_latitude}},{{max_longitude}},{{max_latitude}} {{path/to/input.pbf}} -o {{path/to/output.pbf}}

click the source code to copy install osmium on any operating system with command-not-found.com