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

An empty first highway name output when running osm-length-2.pl to calculate road length

3

Hello,

I am using osm-length-2.pl script to summarize road length of a country. The script is working well except it outputs the first type of highway with an empty name:

highway length sums (metres):

                  38856413m
track              7762817m
secondary          1941725m
residential        1747145m
service            1315326m
path               1080010m
primary             927921m
footway             881391m
...
TOTAL             56823848m

Does anyone have this issue?

This question is marked "community wiki".

asked 08 Sep '16, 04:34

trungnk's gravatar image

trungnk
11115
accept rate: 0%

edited 08 Sep '16, 04:45


One Answer:

4

The script sums up the lengths of all ways, not only highways, and the first number is the length of all non-highway ways. I have modified the script in SVN to stop doing that, so if you check out a new version the first line will be gone.

answered 08 Sep '16, 09:46

Frederik%20Ramm's gravatar image

Frederik Ramm ♦
82.5k927201273
accept rate: 23%

Thanks Frederik. I can see the filters are updated. From osm highway definition almost covers all the type of road. Do the non-highways ways you mentioned are relations?

(09 Sep '16, 00:53) trungnk
1

Ways and relations are different things, see elements. Non-highway ways can be buildings, landuses, water bodies, forests, parks, railways, walls and fences, ways for administrative boundaries and so on.

(09 Sep '16, 07:47) scai ♦

So the non-highway ways are not ways. They take a significant amount of length when the script calculates length of roads. Thus when comparing to the statistic data obtainted we see there are a half kilometres amout deducted after removing non-highways "things"

(09 Sep '16, 13:55) trungnk
1

They are ways, OSM ways :)

(09 Sep '16, 14:25) scai ♦

Source code available on GitHub .