# [postgis-users] break road linestrings intelligently

Jan Hartmann j.l.h.hartmann at uva.nl
Wed Sep 26 01:38:50 PDT 2012

```Hi Rich,

Topology is certainly the way to go: split all crossing linestrings and
create a new layer with the new, topologically correct lines. Start- and
endpoints of the new lines can be easily found by interpolating from the
original lines.

documentation looks daunting, but it's really quite simple. They all
convert linstrings to topological polygons, but it would not be too
difficult to do the same for crossing linestrings to topological
linestrings.

http://trac.osgeo.org/postgis/wiki/UsersWikiTopologyExample (Brent Wood)
http://strk.keybit.net/blog/2012/04/13/simplifying-a-map-layer-using-postgis-topology/
http://trac.osgeo.org/postgis/wiki/UsersWikiSimplifyPreserveTopology
http://trac.osgeo.org/postgis/wiki/UsersWikiSimplifyWithTopologyExt

Cheers,

Jan

On 09/26/2012 03:43 AM, Richard Greenwood wrote:
> I have a table of linestrings representing road centerlines. The
> linestrings have the common "from" and "to" address min/max values.
> But the linestrings are not broken at all of the intersecting streets.
> So I need to break the linestrings at all intersections, but I need to
> populate the "from" and "to" values appropriately in the new
> linestrings. The addressing is based on line length. So I might start
> with a linestring that goes from 100 to 500 and has two intersecting
> streets. I break the original linestring into 3 new linestrings, but
> how do I populate the "from" and "to" values? If I know the order of
> the 3 new linestrings it would be very easy to calculate the new
> values based on the length of each new linestring, eg. line #1
> 100-240, line#2 241-385, line #3 386-500 or some such thing.
>
> It seems like something that topology should help with, but I'm not
> sure where to start. Sorry if I haven't clearly defined my problem.
> Any suggestions are appreciated.
>
> Rich
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20120926/7ced2145/attachment.html>
```