[postgis-users] adding new shape data in existing PostGIS table

Kefyalew Sahle kefyalew_sahle at yahoo.com
Tue Jan 10 03:54:06 PST 2006


Dear Emily Gouge and Michael Fuhr ,
  
  Thank you very much for your advice. I have used the option you mentioned and it has worked very well.
  
    
   the databse name is forestrydb
   the schema name is forest
   the existing PostGIS table name to which the old data is located is forest
   
   the new shape file is forest3.shp 
  the command used is
      
/usr/local/pgsql/bin/shp2pgsql -a forest3.shp forest.forest | /usr/local/pgsql/bin/psql forestrydb
it works very well.
 
 Thank you again for your support.
 
 Kefyalew

 

Emily Gouge <egouge at refractions.net> wrote: Try using the -a option in the shp2pgsql.

So instead of
/usr/local/pgsql/bin/shp2pgsql  forest forest | /usr/local/pgsql/bin/psql -a forestrydb

try
/usr/local/pgsql/bin/shp2pgsql -a forest forest | /usr/local/pgsql/bin/psql forestrydb

Also you can write the output of the shp2pgsql comment to a file instead of the database and try 
looking at the beginning of the file.  If you use the -a option there should be no create table 
statement at the beginning of the file, without the -a option there should be a create table statement.

Emily

Kefyalew Sahle wrote:

>  Hello,
>    
> I have got problem in adding new data in a table that already exist in PostGIS. 
> I used the following command   
> /usr/local/pgsql/bin/shp2pgsql  forest forest | /usr/local/pgsql/bin/psql -a forestrydb 
> 
> I received the following message 
> ERROR:  relation "forest" already exists ............... 
> ERROR:  current transaction is aborted, commands ignored until end of transaction block 
> When running without any options. The task is aborted. The following is the massage displayed after running the shp2pgsql command:
>    Shapefile type: Polygon
>  Postgis type: MULTIPOLYGON[2]
>  BEGIN
>  NOTICE: CREATE TABLE will create implicit sequence "forest_gid_seq1" for serial column "forest.gid"
>  ERROR:  relation "forest" already exists
>  ERROR:  current transaction is aborted, commands ignored until end of transaction block
>  ERROR:  current transaction is aborted, commands ignored until end of transaction block
>  ROLLBACK
>    
> Would you please provide me some information how I can append in my existing PostGIS 
> database new data that is available in shape format?
> Thanks in advance  
> 
> Kef
>   
> 
>   
> ---------------------------------
> Yahoo! Photos
>  Ring in the New Year with Photo Calendars. Add photos, events, holidays, whatever.
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users

_______________________________________________
postgis-users mailing list
postgis-users at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users



		
---------------------------------
Yahoo! Photos
 Ring in the New Year with Photo Calendars. Add photos, events, holidays, whatever.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20060110/9869ab9f/attachment.html>


More information about the postgis-users mailing list