1

In relation to this question here as the image below.
I have a multipolygon geometry (red lines) that i want to turn into lines so i can use it to split another multipoint polygon (black blocks) using ST_Split. enter image description here.

Is there a function equivalent to ST_ExteriorRing that works on multipolygons?
I've tried:

SELECT ST_Split(bldgs.geom, ST_Boundary(admin_boundary))
FROM admin_boundary, bldgs
WHERE admin_boundary.borders = 'N4 2';

ERROR: Splitting a Polygon by a MultiLineString is unsupported

ST_ExteriorRing can't be used because it won't work on multipolygons

2 Answers 2

1

Yes, you have to use ST_Dump

From the manual:

ST_Dump is useful for expanding geometries. It is the reverse of a GROUP BY in that it creates new rows. For example it can be use to expand MULTIPOLYGONS into POLYGONS.

In your case the query would likely look like:

WITH polygons AS (
  SELECT (ST_Dump(geom)).geom 
  FROM admin_boundary
  WHERE admin_boundary.borders = 'N4 2'
)
SELECT 
 ST_Split(bldgs.geom, admin_boundary) geom
FROM bldgs a 
LEFT JOIN polygons b ON ST_Intersects(a.geom, b.geom)
4
  • How does that work in the above context? Aug 16, 2017 at 14:44
  • I've added an example. While checking the docs, I noticed though that cutting with multipolygons shouldn't be a problem. From the ST_Split documentation: When a (multi)polygon is passed as as the blade, its linear component (the boundary) is used for cutting the input.
    – tilt
    Aug 16, 2017 at 14:59
  • Yes, i re-read that and was part of my problem in the above both are multipolygons so the black building blockslayer needs to be turned into lines before being passed to ST_Split Aug 16, 2017 at 15:15
  • Then I would advise you to update your question, or even put a new one. Because the current question and answer don't make sense in that case.
    – tilt
    Aug 17, 2017 at 9:45
0

You can use the create a custom function ST_SplitPolygon as written here. This function allows a multipolygon to be cut by a multline blade

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.