Some trunk roads have multiple ways (oneway=true), how would you go about measure the length of such a road without counting those portions twice ? asked 23 Apr '13, 17:45 pgirolami76 |
Perhaps the easiest option is to use a routing engine (such as OSRM); route from the start to the end of the road (which will probably prefer trunk roads on its default profile); and measure the length of the result. The OSRM demo site will tell you the distance, or you could analyse the GPX export. You could, of course, use your own OSRM instance or the public API. answered 23 Apr '13, 17:56 Richard ♦ |
If you load the data into a PostGIS database (e.g. with osm2pgsql) then you can conceivably run an operation like "draw an area of 50 metres around each bit of a trunk road; if another bit of trunk road falls within that area, delete it". (The relevant PostGIS functions to look up are (Btw. if you have the stuff in PostGIS anyway, it is dead easy to compute the length by using answered 23 Apr '13, 18:51 Frederik Ramm ♦ Yes everything is in postgis and we're working with a treillis. What I want is to know the length of the roads inside each treillis square. The issue here is that for 2-way roads, I'll count twice the length and that's incorrect.
(23 Apr '13, 19:32)
pgirolami76
As I said - compute a buffer around each road and delete others inside that buffer, that should get rid of the 2-way roads.
(24 Apr '13, 07:18)
Frederik Ramm ♦
Can you explain a little more ? How would I create the shape for that road to buffer around if I can't distinguish the ways ?
(24 Apr '13, 17:20)
pgirolami76
Ok, I understand better : you're saying eliminate all the other roads and that will get rid of the other way. But I'm interested in computing the intersected length of all road segments per category (primary, secondary, tertiary) so that wouldn't work. It would however help if I precomputed each road and if I kept in each square only the longest segment per road (=per ref). Is that your idea or was it something else ?
(25 Apr '13, 07:43)
pgirolami76
|
There was a proposal to join the two carriageways into a dual_carriageway relation. This would assist with your question (if in a DC relation only measure one way or the average of the two). It would also assist with the application of maxspeed=national to know difference between a single or dual carriage road without the kludge of adding maxspeed=70 mph / 60 mph when the sign says national speed limit not 60 or 70 mph. answered 23 Apr '13, 18:32 ChrisH yes it would. As would assigning a direction to the ways. Did that ever make any progress ? What was blocking it ?
(23 Apr '13, 19:33)
pgirolami76
Everything in OSM is voluntary, including tagging. I used the relation a little but it didn't catch on so it is not used now AFAIK.
(23 Apr '13, 19:45)
ChrisH
|