[postgis-users] Concern about GEOMUNION() results

strk at refractions.net strk at refractions.net
Tue Feb 1 09:10:35 PST 2005


On Tue, Feb 01, 2005 at 08:51:52AM -0800, James G Wilkinson wrote:
> I am using PostgreSQL v.7.4.2, PostGIS 0.9.0, PROJ v.4.4.7, and GEOS 
> v.2.1.1.
> I have prepared two spatially enabled tables called "test" and "test2."  
> "test" is a
> single polygon, and "test2" is a single line segment (see below for 
> their geometries).
> When I perform a union of the two geometries (also shown below), I 
> expected to
> get a GEOMETRYCOLECTION with three line segments and the polygon.  Instead,
> I received only two line segments and a polygon (results shown below).  
> The third
> line segment that I expected was as follows:
> 
> LINESTRING(-97 42.04,-97.05 42.1)
> 
> Is my expectation wrong?

Yes.
The missing segment of the line is 'absorbed' by the
polygon it overlaps.

If you want your third line you need the intersection of you the
input.

--strk;

> 
> Regards,
> 
> Jim
> 
> 
> beta_jgw=# select * from spatial.test2;
> 
> gid |                  the_geom                  
> -----+---------------------------------------------
>   1 | SRID=4267;LINESTRING(-96.8 41.8,-97.3 42.4)
> (1 row)
> 
> beta_jgw=# select * from spatial.test;
> 
> gid |                            the_geom
> -----+-----------------------------------------------------------------
>   1 | SRID=4267;POLYGON((-97 42,-97.1 42,-97.1 42.1,-97 42.1,-97 42))
> 
> beta_jgw=# select geomunion(a.the_geom, b.the_geom) from spatial.test a, 
> spatial.test2 b;
> 
>                             geomunion
> ------------------------------------------------------------------------------------------
> SRID=-1;GEOMETRYCOLLECTION(LINESTRING(-96.8 41.8,-97 42.04),
> LINESTRING(-97.05 42.1,-97.3 42.4),
> POLYGON((-97 42,-97.1 42,-97.1 42.1,-97.05 42.1,-97 42.1,-97 42.04,-97 42)))
> (1 row)
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users



More information about the postgis-users mailing list