[postgis-users] Can you rebuild a multipolygon from rings?
Ben Madin
lists at remoteinformation.com.au
Fri Oct 21 00:54:28 PDT 2011
Thanks strk,
but I'm still confused. If I don't select the .geom component, I can't dumprings... when I do, I end up with 90 rows in a table of geometry dumps.
# select id, (the_geom).path, st_astext((the_geom).geom) from phl2 where id = 58;
id | path | st_astext
----+------+--------------------------------------------------------------------------------------------------------------
58 | {57} | POLYGON((126.023966 8.568675,126.023895 8.56901,126.013809 8.570289,126.023912 8.56893,126.023966 8.568675))
(1 row)
# select id, ((the_geom).path), st_isvalidreason((the_geom).geom) from phl2 where st_isvalid((the_geom).geom) is false;
NOTICE: Self-intersection at or near point 126.024 8.56893
id | path | st_isvalidreason
----+------+-----------------------------------------------------
58 | {57} | Self-intersection[126.02391195391 8.56893000619979]
which is the polygon ring I want to delete
I can delete it, but I now want to insert this polygon (the remaining 89 rows) back into my table of polgons (the dump from the first step), and then turn them back into a multipolygon. In fact, I can do the last step. But I can't get the geometry dump back into the polygons table in geometry dump format.
Maybe I'm trying to do this wrong, but there must be a function I haven't found?
cheers
Ben
On 21/10/2011, at 3:17 PM, Sandro Santilli wrote:
> On Fri, Oct 21, 2011 at 01:33:43PM +0800, Ben Madin wrote:
>
>> But rebuilding the multipolygons is not so simple (for me) - I need to re-aggregate the remaining rings into a geometry dump to reinsert into the other dumped polygons to rebuild the multipolygon.
>
> ...
>
>> insert into phl (the_geom) select ((st_dump(the_geom))) from summ.ctybnda where year=2005 and ccode like 'PHL';
>
> ...
>
>> insert into phl2 (the_geom) select st_dumprings(((the_geom).geom)) from phl where id = 2601;
>
>
> You're stripping out the "path" component of output from st_dump
> and st_dumprings. Those are the keys to your later rebuilding.
>
> --strk;
>
> () Free GIS & Flash consultant/developer
> /\ http://strk.keybit.net/services.html
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
More information about the postgis-users
mailing list