[R-sig-Geo] Error in readOGR / ogrInfo

Lyndon Estes lestes at princeton.edu
Thu Oct 21 22:59:18 CEST 2010


Hi Ben,

I had pretty much the same problem on my Mac when I was trying to read
an ESRI shapefile in with readOGR.  I still don't know exactly what
caused it, but the problem seems to have been related to my having
first the .shp and its associated files from a Windows machine onto my
Mac, and then tried to use readOGR.  Using readOGR to import the .shp
file directly from the Windows location (with a smb connection) worked
just fine, on the other hand.

It thus seems that OSX did something to the DBF file structure when it
was moved from Windows, and readOGR didn't like it.

Perhaps what I found is not relevant at all, but maybe this experience
provides a starting point for looking for the problem?

Cheers, Lyndon

On Thu, Oct 21, 2010 at 8:13 AM, Ben Madin
<lists at remoteinformation.com.au> wrote:
> G'day all,
>
> I am having a problem with using the rgdal function readOGR, but the error message actually relates to using ogrInfo.
>
>> backgroundmap <- readOGR("PG:dbname=gms user=benmadin password=xdi4frt", "seaplus_countries")
> Error in ogrInfo(dsn = dsn, layer = layer, input_field_name_encoding = input_field_name_encoding) :
>
>        GDAL Error 1: No field definitions found for 'seaplus_countries', is it a table?
>> ogrInfo("PG:dbname=gms user=benmadin password= xdi4frt", "seaplus_countries", input_field_name_encoding=UTF-8)
> Error in ogrInfo("PG:dbname=gms user=benmadin password= xdi4frt", "seaplus_countries",  :
>
>        GDAL Error 1: No field definitions found for 'seaplus_countries', is it a table?
>
>
> Yet when I use ogrInfo from the command line it shows me the information :
>
> warrambat:~ benmadin$ ogrinfo "PG:dbname=gms user=benmadin password= xdi4frt"
> INFO: Open of `PG:dbname=gms user=benmadin password= xdi4frt'
>      using driver `PostgreSQL' successful.
>
> rows deleted
>
> 20: public.country (Multi Polygon)
> 21: public.seaplus_countries (Multi Polygon)
> 22: public.worldboundaries (Multi Polygon)
>
> and I can load the layer and display it in QGIS or uDig.
>
> The problem occurs both in the GUI and the command line versions of R.
>
>> sessionInfo()
> R version 2.11.1 Patched (2010-09-30 r53084)
> Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)
>
> locale:
> [1] en_AU.UTF-8/en_AU.UTF-8/C/C/en_AU.UTF-8/en_AU.UTF-8
>
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
>
> other attached packages:
> [1] rgdal_0.6-28 sp_0.9-72
>
> loaded via a namespace (and not attached):
> [1] grid_2.11.1     lattice_0.19-13
>
> I have tried this with a number of postgis tables in different databases, and it is not working. I am trying to re-run code that has previously worked fine, but I am on a new computer and using R2.11 and a more recent version of rgdal.
>
> My first question is - what does the error message mean?
>
> My second question - why is it occurring in R, but not (apparently) a problem outside of R?
>
> My third question - am I on the right list?
>
> cheers
>
> Ben
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>



-- 
Lyndon Estes
Research Associate
Woodrow Wilson School
Princeton University
+1-609-258-2392 (o)
+1-609-258-6082 (f)
+1-202-431-0496 (m)
lestes at princeton.edu



More information about the R-sig-Geo mailing list