[postgis-users] odd results from intersection and geomunion [solved]

Dylan Beaudette dylan.beaudette at gmail.com
Tue Oct 9 11:24:57 PDT 2007


On Monday 08 October 2007, Dylan Beaudette wrote:
> Hi,
>
> I am performing some simple geometry operations on two data sets which are
> both of type POLYGON and all have valid geometries.
>
> Here is the general idea:
>
> select geomunion(
> 	intersection(geom_A,
> 		buffer( collect(geom_B ))
> 		)
> 	)
>
> group by ...
>
>
> This query produces two unexpected results:
>
> 1. without the GeomUnion: among the POLYGON geomtypes I am also getting
> some others...
>
> ogc_fid | isvalid |       area       |    geometrytype    | numgeometries
> ---------+---------+------------------+--------------------+---------------
>  1051918 | t       |                0 | GEOMETRYCOLLECTION |             0
>  1051930 | t       | 99567.4770585895 | MULTIPOLYGON       |             2
>  1072895 | t       |                0 | GEOMETRYCOLLECTION |             0
>  1073017 | t       | 566721.275024042 | MULTIPOLYGON       |             2
>
>
> .. not sure how these other types are getting in there - artifacts from the
> digitization? Adding a check for geometrytype  != 
> filters out some of the noise, but I cannot figure out why they are there
> in the first place.
>

The bogus GEOMETRYCOLLECTION records were a result of not including an 
intersects(A,B) test in the where clause...



> 2. with the GeomUnion: I get an error:
> NOTICE:  TopologyException: side location conflict
> (-2.11292e+06,-140347,-140347)
> ERROR:  GEOS union() threw an error!
>
>
> System information:
> Linux Debian/Unstable
> All components of PostGIS built from source
>
> GEOS: 2.2.3
> Postgresql: 8.1.3
> PostGIS: 1.2.1

The topology errors were fixed by upgrading to GEOS 3 and postgis 1.3.1 . I 
also added a "buffer(geom, 0.0)" inside of the GeomUnion() just in case.

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