[postgis-users] simple polygon clip

Hugues François hugues.francois at irstea.fr
Mon Nov 10 04:14:10 PST 2014


Hi,

I think you might add a where st_intersects(aoi.geom, line_buffer.geom). If not, your query returns differences between each polygon and each line even if they do not intersect. In this case the difference between the polygon and nothing is the original polygon.

You might also take care when a polygon intersects different lines since your query will return as many differences as the number of intersections. One solution is to union intersected lines.

Hugues

Le 10 nov. 2014 12:58, Christopher Braune <chbraune at uni-potsdam.de> a écrit :
>
> Dear all,
>
> I want to clip polygons like this:
>
>
> I tried the following SQL-sentences:
>
> CREATE TABLE Dear all,

I want to clip polygons like this:


I tried the following SQL-sentences:

CREATE TABLE aoi_blocks AS
SELECT *,
     ST_Difference(aoi.geom, lines.buffer_geom)
     FROM aoi, lines;

I get polygons, but not only the difference polygons!

Thanks for all replies!
Christopher


More information about the postgis-users mailing list