[postgis-users] PostGIS 1.3.3 on Windows XP Unstable
Martin Davis
mbdavis at refractions.net
Wed Aug 13 10:44:01 PDT 2008
Union will have the desired effect, but it isn't the most efficient way
of dealing with the problem. The most efficient way is to iterate over
all the polygons in the MultiPolygon, and drop any which are contained
in another one in the set.
Bresnahan, Mike wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
>
>
>> Martin Davis wrote:
>> That's what it means, alright. It is invalid to have one polygon
>>
> inside
>
>> another one in the same MultiPolygon. (If you post the invalid
>>
> geometry
>
>> I can confirm that this is what is happening).
>>
>> Bottom line is that you need to check for two things:
>> - holes which have "flipped" to be outside their parent shell
>> - polygons which have flipped to be inside another polygon
>>
>
> Ah ok. That is the problem. Is the fix as simple as calling ST_Union()
> on the constituent polygons instead of ST_Collect?
>
> create function ScrubMultiPolygon(input geometry) returns geometry as $$
> begin
> return (select ST_Union(ScrubPolygon(geom)) from (select
> (ST_Dump(input)).geom) as x);
> end;
> $$ LANGUAGE plpgsql;
>
> This appears to work, but I'm not sure if it is the most efficient
> solution.
>
>
> -----BEGIN PGP SIGNATURE-----
> Version: PGP Universal 2.8.3
> Charset: us-ascii
>
> wsBVAwUBSKMarB6WPRoYuvd0AQi0uwgAt3KyQEXLBW0lwbdKXdCOn7sx71KMHu8g
> vJcmnZ8JAyZQYV1VT/uUsNW4cXBj/iG58Ka9r7IU4mcOQvwSyFB6To4yqb/+39Yf
> DuSEVoOTJ5LLtcOfbRlBBrdIwe8oF0tr0Ax5/ZDgjN7+H6bDFVgzzxvg+0arc6ba
> 080jJOeOaXCOpJOTmU6/F/Yve5qZcMZm37d+4vcEwV370oGzzQvCIDPm5OuQF0kN
> wYRmvTyD/3gbvLxXG6SHamDj/psm78EEK961X5KCVDW52VagaW0zdqG6xicNgwOs
> qiHgI4xCCRRyWbmITOOLcUgwAthlveYwySskmPT7RywWYIfLiVIRIw==
> =Xbcq
> -----END PGP SIGNATURE-----
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
>
--
Martin Davis
Senior Technical Architect
Refractions Research, Inc.
(250) 383-3022
More information about the postgis-users
mailing list