4

I've spent 2 days trying to figure this out and I'm afraid that it's something that's not possible. If that's the case then I'm thinking the wrong with with respect to OSM data.

Let's say I have a street, called Main Street. On the displayed map on openstreetmaps.org it looks like one road. To the underlying data it is made up of multiple ways (and is part of a relation of a larger route.)

Let's say I am only interested in the segment that passes through my town which is still made up of multiple ways.

Is there a (easy) way to find out what the ways are which make up this segment?

Is there a way to figure out ways that touch (either the beginning or end) of a way?

I can think of an expensive way (in terms of resources) doing this but I'm afraid that I'm looking at this the wrong way.

I was initially using a XML file that I downloaded of my town but I've also loaded the data into a postgre database (with postgis).

I've read a bunch of questions on stackexchange and the osm website as well. I've looked at this as well: http://wiki.openstreetmap.org/wiki/Elements

1

In postgis:

  1. Group your highways by name and/or by relations membership.
  2. Create MULTILINESTRINGs from such groups
  3. Use http://postgis.net/docs/manual-2.0/ST_LineMerge.html

But still there could be some problems, for example with dual carriageway roads, holes caused by unnamed segments and tree-like road networks.

  • 2
    Also keep in mind that there are different streets that have the same name within a city. In short: it's not that easy. – Mapper Dec 18 '14 at 7:49
  • 3
    @Mapper Yep, but ST_LineMerge at least doesn't merge unconnected segments so you'll get unconnected streets with same name as separate LineStrings. But, for dual carriageways you'll also get separate LineStrings. And so on. – dmitry.v.kiselev Dec 18 '14 at 8:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.