The package takes an openstreetmap pbf file and converts it to a geohash prefix based hdf5 file. It provides an api to then do a fast map matching for any latitude, longitude that comes under the bounding box of the pbf file.
pip install osm-roads
from osm_roads.osm_roads import OsmRoads
osm_roads=OsmRoads(hdf5_file_name="bengaluru.hdf5",openstreetmap_pbf_file_name="bengaluru.pbf")
osm_roads=OsmRoads(hdf5_file_name="bengaluru.hdf5")
osm_roads.get_closest_road(12.934005898750094, 77.61075025215672)
-
Visit the OpenStreetMap Wiki. The file used in the example is downloaded from GeoFabrik, one of the mirrors of OSM and sliced using Osmium Tool
-
Install the Osmium Tool (works well in linux). sudo apt-get install -y osmium-tool
-
Run "osmium extract -b 77.343833,13.159493,77.905509,12.830316 southern-zone-latest.osm.pbf -o bengaluru.pbf" (replace the bounding box lat,lons as per your need)