[postgis-users] Convert multipolygons to separate polygons

Paragon Corporation lr at pcorp.us
Tue Aug 19 20:38:48 PDT 2008


As Mike mentioned below - ST_Dump is probably the fastest way to do this
(faster than ST_GeometryN if you need to dump all polygons out) and  then to
get Point on surface - would look something like this

SELECT sometable.field1, sometable.field2,
ST_PointOnSurface((ST_Dump(the_geom)).geom) As pos 
	 FROM somestatetable


Would dump out a point on surface for each polygon in each multipolygon as
separate records for each poly.

Hope that helps,
Regina
			   

-----Original Message-----
From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of
Bresnahan, Mike
Sent: Tuesday, August 19, 2008 6:59 PM
To: PostGIS Users Discussion
Subject: RE: [postgis-users] Convert multipolygons to separate polygons

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Simon O'Malley said:
> Is there a way to split multipolygons into separate polygon features?
>
> Or is there a way to step through all the polygons in a multipolygon 
> and use pointonsurface to create a point for each polygon in the 
> multipolygon.

ST_Dump()
ST_NumGeometries()
ST_GeometryN()

Reference:
http://postgis.refractions.net/documentation/manual-1.3/ch06.html

-----BEGIN PGP SIGNATURE-----
Version: PGP Universal 2.8.3
Charset: us-ascii

wsBVAwUBSKtP1h6WPRoYuvd0AQh8SggAiupcuwHjhWbmv/HQ6UIhS+VJtizQV43s
EZTvnSXc3LFEG9sr9kCynVFuIwRjeqAf+YLF2JWaK80SR7BJqAoiLxbPdF6dtXDr
Q2K1TiFBomwiWz/zhTRpmraXOI4GPshab1q6mGp01qkXsyt6K+bu1kKdcBIgevJ+
1rXc1zrjK41fec4e3Q1oKOJzNxxW0rEXn8z7pDuGVYSPUhzQyq8e9O6bB6sAq7Y0
42WG0N94wxDRNhSkbqVi9hMYBcwiJ1ffvEmUKCaqywCkg/xHxOXhPqVByRNGKRlJ
pq9w3WWT4e4eNS/FGTqtf4oV+J6nSO7VtpfKSmLM9g+9jZET527Ihg==
=4ROc
-----END PGP SIGNATURE-----
_______________________________________________
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