|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
Split multiple overlapping polygons to polygons that do not overlap.I have a set of polygons.
INSERT INTO test(gid,the_geom) VALUES (1,st_geomfromtext('MULTIPOLYGON (((1 5,1 9,5 9,5 5,1 5)))',2266)); INSERT INTO test(gid,the_geom) VALUES (2,st_geomfromtext('MULTIPOLYGON (((4 2,4 6,8 6,8 2,4 2)))',2266)); INSERT INTO test(gid,the_geom) VALUES (3,st_geomfromtext('MULTIPOLYGON (((4 3,4 6,7 6,7 3,4 3)))',2266)); INSERT INTO test(gid,the_geom) VALUES (4,st_geomfromtext('MULTIPOLYGON (((4 5,4 8,7 8,7 5,4 5)))',2266)); INSERT INTO test(gid,the_geom) VALUES (5,st_geomfromtext('MULTIPOLYGON (((2 3,2 6,5 6,5 3,2 3)))',2266)); They look like the image below with the transparency set so the overlaps are visible. I want to end up with a set of polygons like below. "POLYGON((2 3,2 5,4 5,4 3,2 3))" "POLYGON((2 5,2 6,4 6,4 5,2 5))" "POLYGON((4 6,2 6,2 5,1 5,1 9,5 9,5 8,4 8,4 6))" "POLYGON((4 6,5 6,5 5,4 5,4 6))" "POLYGON((5 6,4 6,4 8,5 8,5 6))" "POLYGON((5 5,5 6,7 6,7 5,5 5))" "POLYGON((5 5,5 3,4 3,4 5,5 5))" "POLYGON((5 3,5 5,7 5,7 3,5 3))" "POLYGON((4 3,5 3,7 3,7 5,7 6,8 6,8 2,4 2,4 3))" "POLYGON((5 8,7 8,7 6,5 6,5 8))" They look like the image below with no overlaps. I am currently creating this using the following sql statement. select st_setsrid((st_dump(st_polygonize(st_geometryn(geom,n)))).geom, 2266) from (select generate_series(1,numgeometries(st_union(lines.geom))) as n, st_union(lines.geom) as geom from (select st_astext(st_boundary((st_dumprings(polys.geom)).geom)) as geom from (select (st_dump(the_geom)).geom from test where geometrytype (the_geom)='MULTIPOLYGON') as polys) as lines) as mline; I think this only works polygons with no holes. Is there a better way to do this using intersections? Thanks, Paul _______________________________________________ postgis-users mailing list postgis-users@... http://postgis.refractions.net/mailman/listinfo/postgis-users |
|
|
Re: Split multiple overlapping polygons to polygons that do not overlap.On Thursday 22 October 2009, Moen, Paul T. wrote:
> I have a set of polygons. > > INSERT INTO test(gid,the_geom) VALUES (1,st_geomfromtext('MULTIPOLYGON > (((1 5,1 9,5 9,5 5,1 5)))',2266)); > INSERT INTO test(gid,the_geom) VALUES (2,st_geomfromtext('MULTIPOLYGON > (((4 2,4 6,8 6,8 2,4 2)))',2266)); > INSERT INTO test(gid,the_geom) VALUES (3,st_geomfromtext('MULTIPOLYGON > (((4 3,4 6,7 6,7 3,4 3)))',2266)); > INSERT INTO test(gid,the_geom) VALUES (4,st_geomfromtext('MULTIPOLYGON > (((4 5,4 8,7 8,7 5,4 5)))',2266)); > INSERT INTO test(gid,the_geom) VALUES (5,st_geomfromtext('MULTIPOLYGON > (((2 3,2 6,5 6,5 3,2 3)))',2266)); > They look like the image below with the transparency set so the > overlaps are visible. Hi, This would be a simple import/export operation in GRASS, due to the topologically-aware storage format that it uses. Cheers, Dylan -- Dylan Beaudette Soil Resource Laboratory http://casoilresource.lawr.ucdavis.edu/ University of California at Davis 530.754.7341 _______________________________________________ postgis-users mailing list postgis-users@... http://postgis.refractions.net/mailman/listinfo/postgis-users |
|
|
Re: Split multiple overlapping polygons to polygonsthat do not overlap.Paul,
Not sure if this would help, but I suspect what Kevin has posted here may be close to what you want. http://trac.osgeo.org/postgis/wiki/UsersWikiSplitPolygonWithLineString Except in your case, you would ST_Union(ST_Boundary(the_geom)) but then the rest of what he has should be about right. Hope that helps, Regina -----Original Message----- From: postgis-users-bounces@... [mailto:postgis-users-bounces@...] On Behalf Of Moen, Paul T. Sent: Thursday, October 22, 2009 12:24 PM To: PostGIS Users Discussion Subject: [postgis-users] Split multiple overlapping polygons to polygonsthat do not overlap. I have a set of polygons. INSERT INTO test(gid,the_geom) VALUES (1,st_geomfromtext('MULTIPOLYGON (((1 5,1 9,5 9,5 5,1 5)))',2266)); INSERT INTO test(gid,the_geom) VALUES (2,st_geomfromtext('MULTIPOLYGON (((4 2,4 6,8 6,8 2,4 2)))',2266)); INSERT INTO test(gid,the_geom) VALUES (3,st_geomfromtext('MULTIPOLYGON (((4 3,4 6,7 6,7 3,4 3)))',2266)); INSERT INTO test(gid,the_geom) VALUES (4,st_geomfromtext('MULTIPOLYGON (((4 5,4 8,7 8,7 5,4 5)))',2266)); INSERT INTO test(gid,the_geom) VALUES (5,st_geomfromtext('MULTIPOLYGON (((2 3,2 6,5 6,5 3,2 3)))',2266)); They look like the image below with the transparency set so the overlaps are visible. _______________________________________________ postgis-users mailing list postgis-users@... http://postgis.refractions.net/mailman/listinfo/postgis-users |
| Free embeddable forum powered by Nabble | Forum Help |