[postgis-devel] RE: [postgis-users] Multipolygons to Polygons

Aaron Racicot aaronr at z-pulley.com
Mon Mar 26 17:18:48 PDT 2007


Check out:

NumGeometries(geometry)
If geometry is a GEOMETRYCOLLECTION (or MULTI*) return the number of
geometries, otherwise return NULL.


GeometryN(geometry,int)
Return the N'th geometry if the geometry is a GEOMETRYCOLLECTION,
MULTIPOINT, MULTILINESTRING or MULTIPOLYGON. Otherwise, return NULL.
Note
Index is 1-based as for OGC specs since version 0.8.0. Previous versions
implemented this as 0-based instead.


+----------------------------------------+
 Aaron Racicot - GIS Programmer  
 360.221.2441 - aaronr at ecotrust.org         
+----------------------------------------+
 e c o t r u s t                       
 pobox 1614
 langley wa 98260
 www.ecotrust.org                      
+----------------------------------------+ 
________________________________________
From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of Leticia
Sent: Monday, March 26, 2007 4:17 PM
To: postgis-devel at postgis.refractions.net
Cc: postgis-users at postgis.refractions.net
Subject: [postgis-users] Multipolygons to Polygons
Importance: High


Can I separate the polygons that conform a multipolygon from SQL?

For example, If I query

SELECT AsText(ogc_geom) as poli from test_table 
I get: 
MULTIPOLYGON(((580525.37 141603.2,580523.3 141629.81,580539.66
141631.09,580540.93 141619.38,580541.46 141608.63,580541.48
141604.73,580525.37 141603.2),(580527.79 141607.36,580532.68
141607.38,580532.61 141622.27,580527.73 141622.26,580527.79 141607.36))) 

which consists of 2 polygons....

Can I run a SQL that let me obtain the two separate polygons?

Thanks in advance,
Leticia




More information about the postgis-devel mailing list