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


Or in miles. How can you calculate the total road length for a country. Or a continent, or a city, etc etc

I installed Qgis and learned to play a little with it.

There i can select to have all roads except track. Or a lot of nice stuff you can do, but one thing that i cannot figure it out in Qgis is to calculate the length of a road. Or calculate the lenght of all the roads.

So i can download once per week and do a query, so i can tell to people that this week we have added 200 km more or roads.

asked 14 Sep '12, 14:33

Badita%20Florin's gravatar image

Badita Florin
accept rate: 0%

edited 15 Sep '12, 14:57

stephan75's gravatar image


One option is to use this Perl script, which will calculate the length of roads in an OSM file: For more details, see this post by Frederik Ramm on the talk mailing list: [OSM-talk] Statistics on road network length?

Some of the other posts in that mailing list thread may be helpful.

permanent link

answered 14 Sep '12, 19:26

Vclaw's gravatar image

accept rate: 22%

-1 i cannot make it work and the other alternative, that i forgot right now what it was, the link it`s no more.

(16 Sep '12, 20:07) Badita Florin

Perhaps this question helps. I am currently waiting for someone to confirm that this is a good approach :)

permanent link

answered 31 Oct '14, 23:23

mvexel's gravatar image

accept rate: 0%

For regular updates, Vclaw's answer is probably best. But I don't think what you were trying to do is difficult in qgis. Here's a tutorial.

permanent link

answered 18 Jun '15, 21:56

joost%20schouppe's gravatar image

joost schouppe
accept rate: 12%

There is a python package that does exactly that.

It is basically a wrapper on top of Overpass that handles the calls.

It supports country-size regions :)

It is super easy to use,

Install it: pip install osm-road-length

And run:

import osm_road_length from shapely import wkt

geometry = wkt.loads('POLYGON((-43.2958811591311 -22.853167273541693,-43.30961406928735 -23.035275736044728,-43.115980036084224 -23.02010939749927,-43.157178766552974 -22.832917893834313,-43.2958811591311 -22.853167273541693))')

length = osm_road_length.get(geometry)

permanent link

answered 30 Apr '20, 22:30

JOAO%20LUIZ's gravatar image

accept rate: 0%

You can use the free CartoType tool ctm1_info on a CartoType map. Both ctm1_info and the makemap tool to create CartoType maps are free for non-commercial use. For example, to get the total road length for Sweden:

ctm1_info sweden.ctm1 -n -aroad/
ctm1_info built using CartoType 6.3.9557

Layer 'road/' has 941,643 objects:
    line objects: 939,897; length = 482121.61 km
    polygon objects: 1746; area = 3.79 sq km
permanent link

answered 15 Jan '21, 14:33

Graham's gravatar image

accept rate: 0%

edited 15 Jan '21, 14:34

With you can select your country, and then select highway=*, select ways, select length and click on results.

permanent link

answered 23 May '22, 21:29

CharliePlett's gravatar image

accept rate: 0%

edited 03 Sep '23, 04:22

Follow this question

By Email:

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



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "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:


question asked: 14 Sep '12, 14:33

question was seen: 10,350 times

last updated: 03 Sep '23, 04:22

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