NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

To apply algorithms like Dijkstra on a graph, we need nodes and the distance between each node as weights. In real world these weighted graphs are actual maps and the weights are distance of road. We are looking for a library or a tool which we can be used to convert these map files(.shp or .osm) into a weighted graph or an adjacency matix?

asked 13 Jan '21, 06:27

Kartikeya's gravatar image

Kartikeya
11112
accept rate: 0%


There are a number of tools which will populate the pgrouting schema in PostGIS from OSM data too: osm2pgrouting and osm2po (latter is closed source proprietary software). You can readily interrogate the pgrouting tables with SQL queries and use different algorithms & weights for routing, so although not the most efficient routing method it's quite a good set-up for experimentation.

Anita Graser has written a number of tutorials about pgrouting itself.

permanent link

answered 13 Jan '21, 13:13

SK53's gravatar image

SK53 ♦
28.1k48268433
accept rate: 22%

Thanks for the help. We just wanted to find the shortest path by a* or dijkstra, but not by any API. We have an osm file and want to extract nodes, edges and the distance between nodes from the same file(python preferably).

(03 Feb '21, 16:02) Kartikeya

https://github.com/Tristramg/osm4routing2 is the easiest I've found to create a routing graph from OSM data.

permanent link

answered 13 Jan '21, 12:39

Richard's gravatar image

Richard ♦
30.9k44279412
accept rate: 18%

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×63
×6
×1
×1
×1

question asked: 13 Jan '21, 06:27

question was seen: 4,800 times

last updated: 03 Feb '21, 16:02

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum