[postgis-users] bringing together two polygon datasets
Sandro Santilli
strk at keybit.net
Tue May 29 02:01:36 PDT 2012
On Tue, May 29, 2012 at 09:48:11AM +0200, Falko Engel wrote:
> Dear list,
>
> I know this is a very basic question, but I can't find any example
> online for this:
>
> I would like to combine two and possibly more (non intersecting)
> polygon datasets into one. This opperation in called "patch" in the
> ESRI-world. Could someone give me an example?
One item for each item in each dataset ?
CREATE TABLE combined AS SELECT
1 as dataset_id, gid, the_geom FROM dataset1
UNION ALL
2 as dataset_id, gid, the_geom FROM dataset2;
Combine items with the same "id" from each dataset ?
CREATE TABLE combined AS SELECT
a.id, st_union(a.the_geom, b.the_geom)
FROM dataset1 a, dataset2 b
WHERE a.id = b.id;
--strk;
,------o-.
| __/ | Delivering high quality PostGIS 2.0 !
| / 2.0 | http://strk.keybit.net - http://vizzuality.com
`-o------'
More information about the postgis-users
mailing list