[prev in list] [next in list] [prev in thread] [next in thread]
List: postgis-users
Subject: Re: [postgis-users] How to calculate the symmetric difference
From: Stefan Keller <sfkeller () gmail ! com>
Date: 2011-02-21 23:36:32
Message-ID: AANLkTi=ymL36w7SvORGLXcOQ=ut+axxxqnwt-t-Ne7v1 () mail ! gmail ! com
[Download RAW message or body]
Right.
I got something like this
SELECT ST_Astext(ST_Difference(ln1.geometry, ln2.geometry))
FROM
streets ln1,
(SELECT ST_Intersection(streets.geometry, forests.geometry) as geometry
FROM streets, forests
WHERE (ST_Intersects(streets.geometry, forests.geometry)
OR ST_Contains(forests.geometry, streets.geometry))
AND NOT ST_Touches(streets.geometry, forests.geometry)
) ln2
WHERE ST_Intersects(ln1.geometry, ln2.geometry)
Yours, S.
2011/2/20 Nicolas Ribot <nicolas.ribot@gmail.com>:
> On 1 February 2011 00:55, Randall, Eric <ERandall@eriecountygov.org> wrote:
>> I guess what I meant was:
>>
>> select st_difference(streets,st_intersection(streets,forests)) as streets
>> from streets, forests
>> where st_intersects(streets,forests)
>> union
>> select streets
>> from streets, forests
>> where not st_intersects(streets,forests)
>>
>
> Isn't it something like:
>
> select st_difference(
> streets.geometry,
> st_intersection(
> streets.geometry,
> forests.geometry)) as streets
> from streets, forests
> where st_intersects(streets.geometry,forests.geometry)
> UNION
> select streets.geometry
> from streets
> where streets.gid not in
> (select streets.gid from streets, forests
> where st_intersects(streets.geometry,forests.geometry));
>
> Otherwise, the negation of st_intersects in the second query returns
> false positives
>
> Nicolas
> _______________________________________________
> postgis-users mailing list
> postgis-users@postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
_______________________________________________
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic