[postgis-users] st_intersection() outputs multipolygons

Dylan Beaudette dylan.beaudette at gmail.com
Tue Apr 22 15:03:51 PDT 2008


Hi,

I have two imput tables with all polygon geometry types, all polygons are 
reported as valid. After performing an intersection, I am left with mixed 
polygon and multipolygon geometry types:

CREATE TABLE dwr.mapunit_dau as
SELECT m_polys.areasymbol, m_polys.mukey, d_polys.dau_id, 
ST_Intersection(d_polys.wkb_geometry, m_polys.wkb_geometry) as wkb_geometry
FROM
	(
	-- subset map unit polygons to certain survey areas
	-- 6.540 s
	SELECT wkb_geometry, areasymbol, mukey
	FROM mapunit_poly
	-- results in 21682 map unit polygons
	WHERE areasymbol in ('ca653', 'ca654', 'ca113')
	) as m_polys
JOIN	
	(
	-- subset DAU polygons that overlap with specific survey areas
	-- 	512 ms
	SELECT dwr.dau.wkb_geometry, dau.dau3_d_id as dau_id
	FROM dwr.dau JOIN mapunit_bound_poly
	-- results in 58 DAU polygons
	ON mapunit_bound_poly.areasymbol in ('ca653', 'ca654', 'ca113')
	and dwr.dau.wkb_geometry && mapunit_bound_poly.wkb_geometry
	) as d_polys
-- join condition: only those polygons which completely intersect
ON ST_Intersects(d_polys.wkb_geometry, m_polys.wkb_geometry);


--
--
--
Looking at the results, I have several geometry types with several total 
geometries per original feature:

SELECT DISTINCT GeometryType(wkb_geometry), ST_NumGeometries(wkb_geometry) 
from mapunit_dau;

 geometrytype | st_numgeometries 
--------------+------------------
 MULTIPOLYGON |                2
 MULTIPOLYGON |                3
 MULTIPOLYGON |                4
 MULTIPOLYGON |                5
 MULTIPOLYGON |                6
 MULTIPOLYGON |                7
 MULTIPOLYGON |                8
 MULTIPOLYGON |                9
 MULTIPOLYGON |               10
 MULTIPOLYGON |               11
 MULTIPOLYGON |               12
 MULTIPOLYGON |               13
 MULTIPOLYGON |               14
 MULTIPOLYGON |               15
 MULTIPOLYGON |               16
 MULTIPOLYGON |               18
 MULTIPOLYGON |               21
 MULTIPOLYGON |               24
 MULTIPOLYGON |               26
 MULTIPOLYGON |               27
 MULTIPOLYGON |               32
 MULTIPOLYGON |               36
 MULTIPOLYGON |               41
 MULTIPOLYGON |               52
 MULTIPOLYGON |               56
 MULTIPOLYGON |               69
 POLYGON      |                 

I have checked, and these multipolygons represent large features, not 
sliver-like artifacts that are commonly left-over from an intersection. Also, 
they contain useful information (non-overlapping polygons) as I traverse the 
geometry tree with GeometryN()...

Any ideas?

Cheers,

Dylan 

-- 
Dylan Beaudette
Soil Resource Laboratory
http://casoilresource.lawr.ucdavis.edu/
University of California at Davis
530.754.7341



More information about the postgis-users mailing list