[postgis-users] Merge all polygons from a dataset

Burgholzer,Robert rwburgholzer at deq.virginia.gov
Fri Aug 1 08:19:36 PDT 2008

Could ArcView perhaps want some columns other than just the shape?
Perhaps you could put a numeric ID or something else in there.


Just a thought,


Robert W. Burgholzer

Surface Water Modeler

Office of Water Supply and Planning

Virginia Department of Environmental Quality

rwburgholzer at deq.virginia.gov


Open Source Modeling Tools:


-----Original Message-----
From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of
Sent: Friday, August 01, 2008 9:30 AM
To: PostGIS Users Discussion
Subject: Re: [postgis-users] Merge all polygons from a dataset


Many thanks, Regina! Indeed ST_Union generated the polygon, invisible in

It creates a nice layer when I open it in uDig. 

However when I export it with pgsql2shp, the shape is unreadable by
ArcView with the errmsg: Number of shapes does not match the number of
table records.

Here's how I created the layer:

create table europe_contour();
SELECT addgeometrycolumn('db, 'europe_contour', 'the_geom',
32767,'MULTIPOLYGON', 2 );
insert into europe_contour(the_geom) values( (select st_union(the_geom)
from europe));

Then I generate the shapefile: 

"c:\Program Files\PostgreSQL\8.3\bin\pgsql2shp.exe" -u postgres -P
password -f europe_contour db europe_contour

Any suggestions perhaps on anything I've wrong?

On Fri, Aug 1, 2008 at 1:15 PM, Obe, Regina <robe.dnd at cityofboston.gov>


How were you using ST_Union and what exactly do you mean by no result.
no result as it looks blank?  If you are using something like PgAdmin
III - it will look blank because it exceeds the buffer supported by
PgAdmin III.


SELECT the_geom is null 

FROM (somequery or table) as foo



will tell you if its actually returning no geometry


Hope that helps,




From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of
Sent: Friday, August 01, 2008 6:12 AM
To: postgis-users at postgis.refractions.net
Subject: [postgis-users] Merge all polygons from a dataset

Hello everybody,

I've converted a shapefile of Europe to PostGIS. I would like to merge
all the countries together so that I only have one polygon left, the
whole contour of Europe. I have tried ST_Union that gives me no result.
I've tried several other functions to no avail. Does anybody know how I
should proceed?

Many thanks,



The substance of this message, including any attachments, may be
confidential, legally privileged and/or exempt from disclosure pursuant
to Massachusetts law. It is intended solely for the addressee. If you
received this in error, please contact the sender and delete the
material from any computer. 


Help make the earth a greener place. If at all possible resist printing
this email and join us in saving paper. 

postgis-users mailing list
postgis-users at postgis.refractions.net


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20080801/a5a831fa/attachment.html>

More information about the postgis-users mailing list