[postgis-users] Merge all polygons from a dataset

danny whatevar89 at gmail.com
Fri Aug 1 06:29:58 PDT 2008

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

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

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>wrote:

>  Erik,
> 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,
> Regina
>  ------------------------------
> *From:* postgis-users-bounces at postgis.refractions.net [mailto:
> postgis-users-bounces at postgis.refractions.net] *On Behalf Of *danny
> *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,
> Erik
> ------------------------------
> * 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
> http://postgis.refractions.net/mailman/listinfo/postgis-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20080801/a578a136/attachment.html>

More information about the postgis-users mailing list