This is a static archive of our old OSM Help Site. Please post any new questions and answers at community.openstreetmap.org.

Get ordered path to calculate kilometer

0

Hi there, i have got a list of incident in Italian motorway and the kilometer where they happened. I should find lat and long of the event. I extracted all nodes from the motorway using this script:

[out:json][timeout:25];
//fetch area “Italy” to search in
{{geocodeArea:Italy}}->.searchArea;
//gather results
(
// query part for: “highway=motorway and ref=A14”
node["highway"="motorway"]["ref"="A14"](area.searchArea);
way["highway"="motorway"]["ref"="A14"](area.searchArea);
relation["highway"="motorway"]["ref"="A14"](area.searchArea);
out body;
>;
out skel qt;

The problem is that while nodes are ordered (so i can calculate relative distance in km of a way), ways aren't. This means i can't create a path of way from the start of the street till the end.

Is there any way to order ways and calculate absolute distance in km?

Thanks for help

asked 12 Oct '18, 09:00

Ramingo92's gravatar image

Ramingo92
11112
accept rate: 0%