[postgis-users] st_intersection() outputs multipolygons
Dylan Beaudette
dylan.beaudette at gmail.com
Wed May 14 08:56:39 PDT 2008
On Wednesday 23 April 2008, Obe, Regina wrote:
> 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
>
Thanks for the clarification Regina. The end result of the analysis worked
well, and I no longer fear the sight of MULTIPOLYGON geometry types.
Cheers,
Dylan
>
> -----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
More information about the postgis-users
mailing list