[GIS] Split very large OSM file

geojsonopenstreetmap

I'm trying to get detailed geojson data for various African countries. I think I found a good source at http://download.geofabrik.de/. The problem is that the downloaded file is in osm format. I know of the osmtogeojson tool, but there is no way this would work on the 32.2GB (!) file I got from Geofabrik. I also have the pbf file which is 1.2 GB.

My question is:

  • Is it a way to split an OSM file (in my example, I could extract data country by country and hopefully feed them to osmtogeojson then)
  • Is it any other way to get detailed geojson info at the subnational level (provinces)?

Best Answer

You can use osmosis or osmfilter to split your OSM source file for specific bounds or tags.

Geofabrik uses osmosis to cut their extracts out of the planet OSM, while osmfilter is quicker if you have certain tags to search for.

You can translate the osm data to other GIS formats using ogr2ogr.