Sort of ugly but… CREATE TEMPORARY TABLE p_edges AS SELECT p.id <http://p.id/>, st_subdivide((st_dumprings((st_dump(geom)).geom)).geom) as geom FROM p;
CREATE INDEX p_edges_geom_x ON p_edges USING GIST (geom); SELECT a.id <http://a.id/>, p.id FROM a JOIN p_edges ON ST_Intersects(a.geom, p_edges.geom) Dump P multipolygon to polygon, polygon to rings, subdivide rings into shorter edges, find all members of A that intersect those edges. > On Dec 5, 2023, at 2:21 PM, Mats Taraldsvik via postgis-users > <postgis-users@lists.osgeo.org> wrote: > > Hi, > > I have a large polygon P in a query against a table A where I'm only > interested in A's polygons that touch/crosses the boundary of P. > > I have tried https://postgis.net/docs/ST_DumpSegments.html but it does > generate a lot of geometries when the polygon has 100s or 1000s of points. > > Are there more efficient approaches to this? > > Regards, > Mats Taraldsvik > _______________________________________________ > postgis-users mailing list > postgis-users@lists.osgeo.org > https://lists.osgeo.org/mailman/listinfo/postgis-users
_______________________________________________ postgis-users mailing list postgis-users@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/postgis-users