[R-sig-Geo] (no subject)

Barry Rowlingson b.rowlingson at lancaster.ac.uk
Tue Aug 21 12:17:45 CEST 2012


On Tue, Aug 21, 2012 at 9:09 AM, katja.flammang at tudor.lu
<katja.flammang at tudor.lu> wrote:
> Hi,
>
> I'm new to this list so I hope I'm not missing anything.
>
> I'm trying to read a file from a database and then write it to my schema in
> the same database. The readOGR function works good but I'm having
> difficulties with writeOGR.
>
> Here is what R is telling me:
>
>> flik_crop_types <- readOGR("PG:dbname=valid host=myhost user=myusername
>> password=mypassword schemas=cbraun","flik_crop_types_08_lux_recl")
>
> OGR data source with driver: PostgreSQL Source: "PG:dbname=valid host=myhost
> user=myusername password=mypassword schemas=cbraun", layer:
> "flik_crop_types_08_lux_recl" with 75836 features and 7 fields Feature type:
> wkbPolygon with 2 dimensions
>
>> writeOGR(flik_crop_types, "PG:dbname=valid host=myhost user=myusername
>> password=mypassword schemas=myschema", "flik_crop_types_08_lux_recl",
>> "PostgreSQL")
>
> Error in writeOGR(flik_crop_types, "PG:dbname=valid host=myhost
> user=myusername password=mypassword schemas=myschema", : Layer creation
> failed

 I can think that either:

 Your PostGIS driver doesn't have write support - what does ogrDrivers() say?

 Is your 'myschema' PostGIS-enabled? Does it have a "geometry_columns" table?

 Another idea is to try writing a normal table to it using the
standard R database connection stuff. That will check you have the
right write permissions...

Barry



More information about the R-sig-Geo mailing list