[postgis-users] breake lines

paul.malm at lfv.se paul.malm at lfv.se
Tue Oct 27 02:21:11 PDT 2020


Hi I would like to break lines in intersections of polygons, but without erasing anything.
I have used this (but now suddenly, it does not work) :


Create table tmpint2 as
WITH
data AS (
   SELECT * FROM public."linesToBeCut" AS t(id, geom)
),
cutter AS (
   SELECT * FROM "cutterPolygons" AS t(geom)
)
SELECT id,
     CASE WHEN cutting IS NULL THEN geom
         ELSE st_collectionExtract(ST_Split( geom, cutting ),2) END AS geom
FROM (SELECT id, d.geom geom,
            (SELECT ST_Collect(c.geom) geom
                FROM cutter c WHERE ST_Intersects(d.geom, c.geom)
            ) AS cutting
    FROM data d) AS t;

The error code I get is :
st_intersects(integer, geometry) does not exsits
Can anyone please tell me what I'm doing wrong here. I'm not to bright in SQL.
/Paul
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20201027/01482124/attachment.html>


More information about the postgis-users mailing list