[postgis-users] Question about ST_Difference across two layers with many multipolygons

Michael Treglia mtreglia at gmail.com
Wed Jul 20 19:34:36 PDT 2016


Hi All,

Please pardon this fairly general question - I'm struggling with using
ST_Difference, and think I might be missing something just about the
intended way ST_Difference functions, as I'm still learning PostGIS... I
think the answer to this will help me troubleshoot or at least lead me to
ask better questions down the line.

So, I have a set of large and many multipolygons (islands) within one
layer, and many smaller sets of multipolygons that are contained within the
islands  (parks) in another layer. I'm trying to effectively clip out the
parks from the islands, so basically the end result will be the Islands
with many holes throughout. The code I was expecting to use was along the
lines of this:

SELECT ST_Difference(islands.geom, parks.geom) AS newgeom INTO
test.islands_noparks FROM staging.parks, staging.islands

However, this is producing the entire islands, but with many rows (just
about as many rows as there are parks). Thus, I think I might be a bit
confused about how ST_Difference is intended to function. Would anybody be
able to clarify?

Thanks so much for your time! Best,
Mike
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20160720/3a2db4d2/attachment.html>


More information about the postgis-users mailing list