[R-sig-Geo] ReadOGR error Multiple # dimensions:

Roger Bivand Roger.Bivand at nhh.no
Fri Aug 21 21:52:41 CEST 2009


On Fri, 21 Aug 2009, Mike Evans wrote:

> I would like to read data from postgis database using the command:
>
> aois <-  readOGR("PG:dbname=wales", "aois")
>
> I get the following error:
>
> aois <-  readOGR("PG:dbname=wales", "aois")
> Error in ogrInfo(dsn = dsn, layer = layer, input_field_name_encoding =
> input_field_name_encoding) :
>  Multiple # dimensions:

This is occurring where some of the objects are defined without a z value 
(2D), and others have a z value (3D). I cannot debug your database, but if 
you can run (worth knowing, but not simple):

debug(ogrInfo)
zz <- ogrInfo("PG:dbname=wales", "aois")

and copy out

assign("eTypes_save", eTypes, envir=globalenv())

once you pass this line (and str(eTypes) shows lots of content):

   eTypes <- .Call("R_OGR_types",as.character(dsn), as.character(layer),
     PACKAGE = "rgdal")
>>> here
   if (is.null(retain)) {

then c to error-exit the function, and

save(eTypes_save, file="eTypes_save.RData")

and send "eTypes_save.RData" to me off-list as an attachment. If you know 
why some objects have different dimensions, you may already know how to 
resolve this at the database end.

Hope this helps,

Roger

>
> I assume I have the syntax correct. Any advise?  I could of course 
> export the data into a shape file using pgsql2shp and import that I 
> guess but...
>
>
>
>

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no



More information about the R-sig-Geo mailing list