[postgis-users] export polygon to shapefile problem

Kevin Neufeld kneufeld at refractions.net
Wed Nov 17 08:31:34 PST 2010

I suspect your merge process worked because you added an attribute 
column (gid) to the exported geometries.

Try adding some attribute on the fly ... something like this:

pgsql2shp -f polys.shp postgis "SELECT null::char AS blank_attr, 
the_geom FROM my_poly_table"

-- Kevin

On 11/17/2010 5:32 AM, Thomas Kouk wrote:
> I left the -a_srs out and I no longer have the usage information, but 
> instead I have an error message:
> ESRI Shapefile driver failed to create file.shp.
> The same happens for other spatial tables as well (not necessarily 
> polygons).
> The table contains only a geometry column. The funny thing is that if 
> I use a script to merge a lot of such tables into one, adding a gid 
> column so that I can distinguish them, using the command I tried in 
> the beginning:
>  pgsql2shp -P [password] -f [shapefile path & name] postgis [tablename]
> works fine! However it would be stupid to create another script to 
> split the data and deal with this in this way.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20101117/bfab9a5a/attachment.html>

More information about the postgis-users mailing list