[postgis-users] create holes in ocean polygons with island polygons

paul.malm at lfv.se paul.malm at lfv.se
Tue Aug 20 23:09:52 PDT 2019


Thanks Darafei, perfect!
Just for newbees like me if they read this mail:
you have missed one “)” at the near end
UPDATE public."Ocean"
SET the_geom = coalesce(ST_Multi(ST_Difference("Ocean".the_geom, (select ST_Union(the_geom) from "Islands" as b where ST_Intersects( "Ocean ".the_geom,  b.the_geom)))), the_geom);


Från: postgis-users [mailto:postgis-users-bounces at lists.osgeo.org] För Darafei "Kom?pa" Praliaskouski
Skickat: den 20 augusti 2019 15:38
Till: PostGIS Users Discussion
Ämne: Re: [postgis-users] create holes in ocean polygons with island polygons

You're getting a copy of each ocean for each island with that island removed, and only one gets back into the table. You probably want to remove an union of all islands from each ocean.

UPDATE public."Ocean"
SET the_geom = coalesce(ST_Multi(ST_Difference("Ocean".the_geom, (select ST_Union(the_geom) from "Islands" where ST_Intersects( "Ocean ".the_geom,  b.the_geom))), the_geom);

On Tue, Aug 20, 2019 at 4:35 PM <paul.malm at lfv.se<mailto:paul.malm at lfv.se>> wrote:
Hi,
I have a table with ocean polygons and would like to create holes in those polygons with an island layer (including island polygons).
I’ve tried this:

UPDATE public."Ocean"
SET the_geom = ST_Multi(ST_Difference("Ocean".the_geom, b.the_geom))
FROM "Islands" as b
WHERE ST_Intersects( "Ocean ".the_geom,  b.the_geom)
Postgresql reports  5 uppdates.
But there are no holes in the ocean polygons, in the location of the islands.

What are I’m doing wrong?

Kind regards,
Paul
_______________________________________________
postgis-users mailing list
postgis-users at lists.osgeo.org<mailto:postgis-users at lists.osgeo.org>
https://lists.osgeo.org/mailman/listinfo/postgis-users


--
Darafei Praliaskouski
Support me: http://patreon.com/komzpa
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20190821/17a23fc3/attachment.html>


More information about the postgis-users mailing list