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


I am doing data analysis on geographical areas and need the total length of streets/ roads in a map area. How do I do this??

asked 23 Mar '11, 18:39

ajackson's gravatar image

accept rate: 0%

edited 25 Mar '11, 11:51

TomH's gravatar image

TomH ♦♦

you can do this by loading the planetfile (all osm-data) or an extract of it into a database. In OSM we use PostgreSQL with the PostGIS extension. Then you can make queries on the database to get the answers to your questions. To get the downloaded data into your database, there are different solutions available, e.g. osmosis (allowing for a full copy) or osm2pgsql (used to create extracts with only a part of the data according to tags you choose).

If you want to analyze the data and obtain real lengths and areas you should not use the spherical mercator projection (900913) we generally use to render maps, because the results are not real world units in this projection.

permanent link

answered 23 Mar '11, 18:47

dieterdreist's gravatar image

accept rate: 3%

permanent link

answered 23 Mar '11, 19:20

Frederik%20Ramm's gravatar image

Frederik Ramm ♦
accept rate: 23%

edited 09 Nov '13, 03:28

amritkarma's gravatar image


Okay. Lets try this again. I am not familiar with the systems you reference. I am downloading county and state date on crimes, and need to calculate the total length of the streets/ roads in the area for certian calculations. I am not a programmer, atleast not since 1975, and am not famikliar with more recent systems. Is ther a simle wat to get this information?

permanent link

answered 23 Mar '11, 20:11

ajackson's gravatar image

accept rate: 0%


I linked you to several OSM-tools which are described on the pages. If you already have an extract covering exactly the area you want to analyze you can directly use the script Frederik linked above. Otherwise you will have to cut the desired area out of a bigger extract (if it is not very small and you can download it via JOSM). Cutting out of OSM data is usually done with Osmosis. You can download it from svn ( ). Examples and explanations (also for installing/compiling) are in the wiki:

(23 Mar '11, 20:16) dieterdreist

There is no simpler way to get this information. If you happen to have some GIS software at hand that can compute road lengths then you might download a matching shape file for your area of interest from but even that requires that you know your GIS program and invest some time. If you are lucky then you can find someone to do this work for you - but they will have to perform the exact steps we have outlined above and which you are unable or unwilling to perform. A polite request to the mailing list or forum, with details about the areas of interest, 'might' work.

(23 Mar '11, 21:38) Frederik Ramm ♦

Yes, there's a simpler way -- pay a consultant to produce the data for you. You could try the companies listed at for a start.

(23 Mar '11, 21:43) Jonathan Ben...

You can either go to this notebook and easily get this data:

Or, there is a python package that does exactly that:

It is super easy,

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:27

JOAO%20LUIZ's gravatar image

accept rate: 0%

edited 17 Nov '20, 15:32

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: 23 Mar '11, 18:39

question was seen: 24,663 times

last updated: 17 Nov '20, 15:32

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