0

I am a bit lost and I am hoping that someone will help me start and hopefully help others as well. My requirements are pretty straightforward. I want to download raw data for the:

  • Latitude
  • Longitude
  • How are nodes connected in the graph
  • Distance between the connected nodes

For example:

nodeA  nodeB  Latitude Longitude Distance(meters)
1566   1602   52.29323 -23.23252 125.256
1661   1783   26.23452 -21.24152 261.45
...

For this I understand that I first have to download a .osm file and then read the data with a parser. However, that just seems really vague to me. The documentation seems a bit confusing and not straightforward to me.

So I wanna ask, how can I download the data mentioned above for a specific country or city ? (I want to download the data of Athens).

Then the next question is what file format will those data be in ? and how will I extract the above information from that file ?

asked 16 Mar '16, 02:42

shiro900's gravatar image

shiro900
54449
accept rate: 0%


2 Answers:
1

You can get city specific datasets e.g. at mapzen, e.g. OSM XML format for Athens.

There you have all the nodes of the city. Read about the OSM XML file format.

Write a script in your favourite programming language to parse this, extract the nodes that you need, calculate the distance and write out the list format (CSV, whatever) that you need.

For geographical distance calculations, you need an appropriate geo library, e.g. Proj. I can’t help you with that, it’s over my head.

Another approach might be feeding the data into a geo enabled database like PostGIS und use its functions.

permanent link

answered 16 Mar '16, 03:50

Hraban's gravatar image

Hraban
1864610
accept rate: 0%

edited 16 Mar '16, 03:50

For topology - whether nodes are connected by a line or not - you will have to evaluate the "way" objects as well. For distance in meters, use your favourite search engine to dig up the Haversine Formula.

(16 Mar '16, 06:40) Frederik Ramm ♦

@FrederikRamm I am just surprised that there is no official library or instructions with examples on how to do that.

(16 Mar '16, 06:57) shiro900
1

There's tons of open source routing engines (routino, osrm, graphhopper, osm2pgrouting, ...) where you can look at how it's done. Extracting a graph from OSM data is a very specific requirement that rarely occurs outside of routing engines. There's a couple good general OSM processing libraries (eg Osmium and its Javacript and Python bindings) but that only helps you with parsing, you'll still have to build the kind of graph you want yourself.

(16 Mar '16, 07:51) Frederik Ramm ♦

@FederikRamm I was trying to install imposm and I got this error which I posted on their github. Do you by any chance know what is happening ?

(16 Mar '16, 15:05) shiro900
0

Sorry I'm little bit late, but you can use this software

https://github.com/rovaniemi/osm-graph-parser

permanent link

answered 08 Jun '17, 13:41

vanhapanda's gravatar image

vanhapanda
1
accept rate: 0%

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:

×287
×71

question asked: 16 Mar '16, 02:42

question was seen: 5,176 times

last updated: 08 Jun '17, 13:41

powered by OSQA