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

4
4

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

ajackson
76234
accept rate: 0%

edited 25 Mar '11, 11:51

TomH's gravatar image

TomH ♦♦
3.3k83943


permanent link

answered 23 Mar '11, 19:20

Frederik%20Ramm's gravatar image

Frederik Ramm ♦
82.5k927201273
accept rate: 23%

edited 09 Nov '13, 03:28

amritkarma's gravatar image

amritkarma
684212941

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

dieterdreist
3.7k113567
accept rate: 3%

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

ajackson
76234
accept rate: 0%

1

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 ( http://svn.openstreetmap.org/applications/utils/osmosis/trunk/ ). Examples and explanations (also for installing/compiling) are in the wiki: http://wiki.openstreetmap.org/wiki/Osmosis

(23 Mar '11, 20:16) dieterdreist
2

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 download.geofabrik.de 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 ♦
5

Yes, there's a simpler way -- pay a consultant to produce the data for you. You could try the companies listed at http://wiki.openstreetmap.org/wiki/Commercial_OSM_Software_and_Services for a start.

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

You can either go to this notebook and easily get this data: https://colab.research.google.com/drive/1NMgWTtr4vPyD8YoZNt3DCkQ1y8EOCa7R#scrollTo=2vtNdIjSz5E2

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

https://github.com/JoaoCarabetta/osm-road-length

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

JOAO LUIZ
161
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

By RSS:

Answers

Answers and Comments

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:

×142
×16

question asked: 23 Mar '11, 18:39

question was seen: 25,755 times

last updated: 17 Nov '20, 15:32

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