[postgis-users] st_difference results

Pedro Costa pedrocostaarma at sapo.pt
Fri Jun 28 05:20:45 PDT 2013


Hi people,

I'm trying to make an st_difference with polygons and lines. But the 
result is a thousand of features because i get the difference between 
each polygon on the left side and ALL of the linestrings on the right.

I want only simple linestrings (not multi)  that don't intersect the 
polygons (ss attached).
My query:

     CREATE TABLE sample2 AS (
                         SELECT (st_difference(p.geom,l.geom)
                         FROM lines l,polygons p
                         WHERE st_intersects (p.geom, l.geom) = true
                                 );

Any guess how to limit the result to what i want?

Thanks


More information about the postgis-users mailing list