PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Monday, June 27, 2022

[FIXED] How to extract street graph or network from OpenStreetMap?

 June 27, 2022     graph, networking, openstreetmap, osmnx, overpass-api     No comments   

Issue

How to extract street graph or network from OpenStreetMap ?


Solution

Solutions:

There are many solutions to achieve this goal, I listed some of them below.

- Overpass-api

Overpass-api & overpass-turbo let you use overpass query language to collect ways and nodes of type highway for a city :

[out:xml]; area[name = "Pantin"]; (way(area)[highway]; ); (._;>;); out;

Pantin is a city in France overpass-turbo

- Geofabrik & Osmium

Geofabrik allows you to download various datasets from continents to cities.

Next, extract nodes and ways of type highway using Osmium tag-filters:

osmium tags-filter map.osm w/highway -o highways-ways.osm

NOTE: osmium tags-filter also works with .pbf files

- Ophois

Ophois is a CLI tool written in Rust, i created to:

  • Download a map from overpass-api
  • Process data from Overpass or Geofabrik to extract the street graph
  • Simplify the extracted graph with detailed heuristics
  • Discretize the extracted or simplified graph to a distance in meter

I also created a simple tool to display the generated graph on a Leaflet map to check the simplification process, cartographe.
Cartographe let you check the node id and the distance of links in meters using haversine formula.

Extracted

Pantin extracted from overpass-api using Ophois

Simplified

Pantin simplified using Ophois

Simplified and Discretized

Pantin simplified and discretized using Ophois

NOTE: Simplified and discretized with 10 meters parameter

- OSMnx

OSMnx: Python for street networks. Retrieve, model, analyze, and visualize street networks and other spatial data from OpenStreetMap.
Pantin-osmnx

NOTE: Pantin using OSMnx



Answered By - ethicnology
Answer Checked By - Terry (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing