Hi again,

The "overwrite=no" doesn't work (it is not recognized so the error I get is that the table yet exists).

I'm using R not only to save my shape files into a database but to "sptransform" some of them and to perform some operations on them.

I've made a script to do all operations over the shapes and to write them in a unique folder. So, I could process them using shp2pgsql (with the "-a" flag for appending them to an existing table).

But I would like to do it using R because the current approach (reading, processing, writting to disk, reading and writting to DB) is not efficient at all. The alternative (reading, processing, writting to a temp table, moving to the final table and dropping the temp table) is better but it still has some expendable steps.

Any other idea?

Thanks,
Germán Sánchez

On 22/04/2010, Alex Mandel wrote:
The obvious question here, what happens if you set overwrite=no?

If the only thing you're using R for is converting a shapefile to
postgis you might want to just use ogr2ogr on the command line with the
-append option. Postgis also ships with a shp2pgsql tool that might
handle this too.

Alternately you can always load more data into a temp table and then run
 some SQL to add the additional records to the first table.


Alex

El 22/04/2010, a las 14:03, German Sanchez Hernandez escribió:

> Dear all,
> 
> I'm trying to save some shapes to a postGIS table. I can do it by:
> 
>  shape <- readShapePoly(...)
>  writeOGR(shape, dsn="PG:dbname=gis user=gis password=...", layer='onetable', driver="PostgreSQL", layer_options="overwrite=yes")
> 
> It empties the "onetable" table. Then, how could I do if I want to add other shape to this table without overwritting it?
> 
> I've searched for the params of "layer_options", but I didn't find nothing.
> 
> Thank you!
> Germán Sánchez
> 


	[[alternative HTML version deleted]]

