[postgis-users] Union of 2 polygon shape files

Håvard Tveite havard.tveite at umb.no
Thu May 8 07:11:18 PDT 2008


RAVI KUMAR wrote:
> Hi Havard,
> what are equal opperation of Overlay in Post GIS.

ST_Intersection

Given two tables a and b, each with the following attributes:
id INTEGER, geom ST_Polygon

the following query should give you something that is
similar to the result of a GIS overlay operation (I
guess the resulting geometries may be both polygons
and multipolygons):

select a.id, b.id, ST_Intersection(a.geom, b.geom) as intgeom
from a, b
where ST_Intersects(a.geom, b.geom);

Håvard

> Ravi Kumar
> */Havard Tveite <havard.tveite at umb.no>/* wrote:
> 
>     Dear Ravi,
> 
>     You should specify what you expect the Union operation
>     to do.
>     The PostGIS (ST_)Union is not the same as an overlay (if
>     that is what you want to achieve).
>     The union operation joins two geometries or a set of
>     geometries (the aggregation version) together to form a
>     new geometry.
> 
>     Håvard
> 
> 
>     ST_Union(geometry, geometry)
>     Returns a geometry that represents the point set union of the
>     Geometries.
>     Performed by the GEOS module
>     Do not call with a GeometryCollection as an argument
>     NOTE: this is renamed from "union" because union is an SQL reserved
>     word
>     OGC SPEC s2.1.1.3
>     ST_Union(geometry set)
>     Returns a geometry that represents the point set union of this all
>     Geometries in given set.
>     Performed by the GEOS module
>     Do not call with a GeometryCollection in the argument set
>     Not explicitly defined in OGC SPEC
> 
> 
>     RAVI KUMAR wrote:
>      > Hi,
>      > I find that Union of 2 polygon shape files is not what is
>     expected from
>      > other FOSS GIS like GRASS etc. I can send two small shape files
>     with a
>      > few polygons and the anticipated result. Pl let me know to whom I
>     should
>      > mail it for help, such that UNION with PostGIS can be used after
>      > necessary modifications.
>      >
>      > This will clear a roadblock for me in a exercise on Mineral
>      > prognastication using FOSS GIS.
>      > Ravi Kumar
>      >
>      >
>     ------------------------------------------------------------------------
>      > Be a better friend, newshound, and know-it-all with Yahoo!
>     Mobile. Try
>      > it now.
>      >
>      > >
>      >
> 
>     -- 
>     --
>     Håvard Tveite
>     Department of Mathematical Sciences and Technology
>     Norwegian University of Life Sciences
> 
> 
> ------------------------------------------------------------------------
> Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try 
> it now. 
> <http://us.rd.yahoo.com/evt=51733/*http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ 
>  >
> 

-- 
Håvard Tveite
Department of Mathematical Sciences and Technology, UMB
Drøbakveien 31, POBox 5003, N-1432 Ås, NORWAY
Phone: +47 64965483 Fax: +47 64965401 http://www.umb.no/imt/



More information about the postgis-users mailing list