[postgis-users] splitting linestrings with a polygon

paul.malm at lfv.se paul.malm at lfv.se
Tue Aug 20 00:09:33 PDT 2019


Hi, I have a problem with MultiLinestrings/Linestrings.
I have one layer with Linestrings which I would like to split in the intersections of a polygon (MultiPolygon) in a polygon layer.

I tried this:
UPDATE public."linelayer" b
    SET the_geom = ST_Intersection(b.the_geom, p.the_geom)
    FROM public."polygonlayer" p
    WHERE ST_Intersects(b.the_geom, p.the_geom)


I'm getting this error: ERROR: Geometry type (MultiLineString) does not match column type (LineString) SQL state: 22023

Then I tried to make the Linsestrings to MultiLinestrings, before splitting the lines:
ALTER TABLE public."linelayer" ALTER COLUMN "the_geom" TYPE geometry(MultiLinestring,"32633") USING ST_Multi("the_geom")

And tried to split the lines again with the first expression, but gets this opposite error instead:
ERROR: FEL: Geometry type (LineString) does not match column type (MultiLineString) SQL state: 22023

What is it that I missed with MultiLinestring/Linestring?

What the heck can I do, seems like "Moment 22"?
Kind regards,
Paul


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20190820/7141efad/attachment.html>


More information about the postgis-users mailing list