[postgis-users] Checking for Line Continuity

Rodrigo Martín LÓPEZ GREGORIO rodrigomlg at gmail.com
Sun Aug 5 21:33:33 PDT 2007


Hi Rupert...

I think an easy way to do this is something like:

select * from yourTempTable
where GeometryType(LineMerge(the_geom)) = 'MULTILINESTRING'

If the diferents linestrings in a multilinestring can be joined into one
linestring without gaps then the LineMerge function will return a
'Linestring' geometry; otherwise it will return a 'Multilinestring' geometry
and that may be what you want. However this doesn't check if the endPoint of
each linestring in your multilinestring is the same point as the startPoint
of the next linestring in your multilinestring. I don't know if I'm very
clear about that so I give you some examples:

select AsText(LineMerge(GeometryFromText('MULTILINESTRING((0 0, 1 1),(1 1, 2
2),(2 2, 3 3))')))

it will return Linestring as expected;

select AsText(LineMerge(GeometryFromText('MULTILINESTRING((0 0, 1 1),(2 2, 3
3),(4 4, 5 5))')))

it will return a Multilinestring as expected;

select AsText(LineMerge(GeometryFromText('MULTILINESTRING((0 0, 1 1),(2 2, 3
3),(1 1, 2 2))')))

it will return a Linestring, cause the join of the 3 linestring has no gaps
even when the linestrings are not joined in order.

I hope I was clear enough.

Rodrigo.


On 8/6/07, Rupert <rndguzmanjr at gmail.com> wrote:
>
> Hi List,
>
> How can I check for line continuity in TEMP Table ?
> The table consists of 1200 records, where the_geom is
> MULTILINESTRING. I want to know which records have
> discontinuous lines, like the attached image.
>
> Regards,
>
> Rupert
>
>
>
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20070806/6307e4e7/attachment.html>


More information about the postgis-users mailing list