Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sahyagiri/osm_roads
https://github.com/sahyagiri/osm_roads
geohash geolocation h5py hdf5 map-match map-matching openstreetmap pbf s2geometry
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/sahyagiri/osm_roads
- Owner: sahyagiri
- License: mit
- Created: 2022-01-29T12:35:39.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-02-06T14:32:11.000Z (almost 3 years ago)
- Last Synced: 2024-04-26T19:04:00.343Z (8 months ago)
- Topics: geohash, geolocation, h5py, hdf5, map-match, map-matching, openstreetmap, pbf, s2geometry
- Language: Python
- Homepage: https://dossiers.page/whats-near-me-space-filling-curves-and-radix-tree-in-geospatial-applications/
- Size: 24 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# OpenStreetMap Roads
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.
### Installation
pip install osm-roads## Importing and loading the pbf file
from osm_roads.osm_roads import OsmRoadsosm_roads=OsmRoads(hdf5_file_name="bengaluru.hdf5",openstreetmap_pbf_file_name="bengaluru.pbf")
## Closing the file handler
## Opening the HDF5 osm file
osm_roads=OsmRoads(hdf5_file_name="bengaluru.hdf5")## Search for map matching with latitude and longitude
osm_roads.get_closest_road(12.934005898750094, 77.61075025215672)
![Output](sample_output.png)
### How to get PBF files and slice them
1. Visit the [OpenStreetMap Wiki](https://wiki.openstreetmap.org/wiki/Planet.osm). The file used in the example is downloaded from [GeoFabrik](https://download.geofabrik.de/asia/india.html), one of the mirrors of OSM and sliced using Osmium Tool2. Install the Osmium Tool (works well in linux). sudo apt-get install -y osmium-tool
3. 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)