I have exported a map that represents part of city. I have measured road length with the measurement plugin in JOSM. I have realised that the map that appear in JOSM is bigger than the one I have exported as it seems to includes full length of ways of which I have only selected a part, one of them looks like the city limit. As result if I select everything, road length measured by the plugin is much bigger than the measurement obtained when I manually select just the area I have previously exported. I have also tried the osm-length-2.pl script, whose result is the same as when I consider the whole area that appears in JOSM. However, I have realised that when results are detailed, it exists one distance that is not assigned to any road type, is this distance the length of the extra roads that are considered despite not being selected? How can I make sure I get the length of the roads just in the area I choose and export? If possible, I would like to have different road type length detailed, as in osm-length-2.pl results.

asked 13 Apr '16, 09:59

Fa__'s gravatar image

accept rate: 0%

edited 13 Apr '16, 12:32

JOSM is an editor not an analytical tool.

In addition to using PostGIS as suggested by Frederik you can also import data into QGIS which allows the same operations (clipping, filtering & measurement) to be performed.

permanent link

answered 13 Apr '16, 13:03

SK53's gravatar image

SK53 ♦
accept rate: 20%

edited 13 Apr '16, 21:23

Import your data set into PostGIS with osm2pgsql, then you have full control over what gets counted and how. You could for example take a clipping polygon e.g. the administrative boundary and have all roads clipped at that boundary, with a query similar to this:

SELECT way AS clip
INTO clipping_polygon
FROM planet_osm_polygon
WHERE boundary='administrative' AND admin_level='8' and name='My City';

SELECT name, highway, ST_INTERSECTION(way, clip)
INTO clipped_roads
FROM planet_osm_line, clipping_polygon

Then you could count the total length in metres per highway type like this

SELECT highway, SUM(ST_LENGTH(way::geography))
FROM clipped_roads
GROUP BY highway;
permanent link

answered 13 Apr '16, 12:15

Frederik%20Ramm's gravatar image

Frederik Ramm ♦
accept rate: 24%

Your answer
toggle preview

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](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:


question asked: 13 Apr '16, 09:59

question was seen: 2,478 times

last updated: 13 Apr '16, 21:23

powered by OSQA