[postgis-users] Retrieve the portion of line external to polygon
Andrea Peri
aperi2007 at gmail.com
Wed Feb 16 09:47:53 PST 2011
Look this simple example
the difference between the line and the same line intersected with the
polygon is equal to the line :)
select 1, ST_Difference(ST_GeomFromText('LINESTRING(10.9 2, 11
8)'),ST_Intersection(ST_GeomFromText('LINESTRING(10.9 2, 11 8)'),
ST_GeomFromText('POLYGON((12 2, 10 10, 20 21, 21 5, 12 2))')))
the trick is that in the intersection point between polygon and line, the
vertex added move the line so the difference fail to
remove the internal portion.
2011/2/16 strk <strk at keybit.net>
> On Tue, Feb 15, 2011 at 11:16:44PM +0100, aperi2007 wrote:
> > Hi,
> >
> > I need to retrieve the portion of a line external to a polygon,
> > I try with the ST_Difference and the ST_Intersections but both seem to
> > work only with geometries of same type.
>
> ST_Difference should work.
> Do you have a _small_ example showing it doesn't ?
>
> --strk;
>
> () Free GIS & Flash consultant/developer
> /\ http://strk.keybit.net/services.html
>
--
-----------------
Andrea Peri
. . . . . . . . .
qwerty àèìòù
-----------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20110216/a826d628/attachment.html>
More information about the postgis-users
mailing list