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.ri...@gmail.com>: > On 1 February 2011 00:55, Randall, Eric <erand...@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