[postgis-users] st_intersection() outputs multipolygons

Obe, Regina robe.dnd at cityofboston.gov
Wed Apr 23 05:37:07 PDT 2008


Dylan,

Are you trying to make them all the same or all into POLYGONS?  If you
end up with POLYGONS that don't touch (which is quite common with
st_intersection even n non-sliver cases) I think they have to be
represented as MULTIPOLYGONS so the best you can do is row creation and
break each out into a separate record or make your POLYGON a multi by
doing

ST_Multi(ST_Intersection(...))

so you can put constraints on it.

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
Dylan Beaudette
Sent: Tuesday, April 22, 2008 6:04 PM
To: PostGIS Mailingliste
Subject: [postgis-users] st_intersection() outputs multipolygons

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
_______________________________________________
postgis-users mailing list
postgis-users at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users
-----------------------------------------
The substance of this message, including any attachments, may be
confidential, legally privileged and/or exempt from disclosure
pursuant to Massachusetts law. It is intended
solely for the addressee. If you received this in error, please
contact the sender and delete the material from any computer.




More information about the postgis-users mailing list