Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tofull/networkx-osm
import open street map data as a networkx graph
https://github.com/tofull/networkx-osm
graph networkx osm parser road shapefile shp
Last synced: about 2 months ago
JSON representation
import open street map data as a networkx graph
- Host: GitHub
- URL: https://github.com/tofull/networkx-osm
- Owner: Tofull
- Created: 2019-12-20T23:09:14.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2019-12-20T23:10:02.000Z (about 5 years ago)
- Last Synced: 2024-04-24T02:53:38.678Z (9 months ago)
- Topics: graph, networkx, osm, parser, road, shapefile, shp
- Language: Python
- Size: 1.64 MB
- Stars: 22
- Watchers: 4
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# OSM Road Parser
Convert a Open Street Maps `.map` format file into a networkx directional graph.This parser is based on the osm to networkx tool from aflaxman : https://gist.github.com/aflaxman/287370/
Added :
- python3.6 compatibility
- networkx v2 compatibility
- cache to avoid downloading the same osm tiles again and again
- distance computation to estimate length of each ways (useful to compute the shortest path)# Installation
```sh
pip install -r requirements.txt
```# Examples
![OSM exporter](doc/osm_road_exporter.png)
![Networkx graph](doc/osm_networkx_graph.png)
![OSM to SHP](doc/osm_to_shp.png)- Download osm data and display the networkx graph into matplotlib.
```sh
python examples/display_osm_graph.py
```
- Load osm data from a `.map` file and convert the graph to shapefile
```sh
# Requires osgeo python package --> https://pythongisandstuff.wordpress.com/2016/04/13/installing-gdal-ogr-for-python-on-windows/
python examples/convert_osm_to_shp.py
```