[R-sig-Geo] rgdal readOGR() problem

Roger Bivand Roger.Bivand at nhh.no
Wed Feb 3 10:21:27 CET 2016


Following contact offlist, it appears that the handling of *List fields in 
the GDAL/OGR 1.7.3 GeoJSON driver is broken (release over 5 years old, 
support for *List field splitting in ogr2ogr from 1.8.0, etc.). The only 
resolution is upgrading GDAL on the production system.

Incidentally, note that GDAL 1.11.4 may be the last 1.* series bug-fix 
release; 2.0.2 is the current release, and 2.1.0 is in progress as the 
development release. Fedora is at GDAL 2.0.1, but Debian-based 
distributions are at best at 1.11.*. Debian and Ubuntu users and 
derivatives should consider installing from source unless upstream 
packages depend on outdated GDAL versions. Note the GDAL version reported 
when rgdal is loaded - bug fixes occur all the time, so keeping close to 
current removes the risk of user errors being down to out-of-date GDAL 
support.

Roger

On Thu, 28 Jan 2016, Roger Bivand wrote:

> On Thu, 28 Jan 2016, Philip Greenwood wrote:
>
>>  I am trying to compute distance spatial weight matrices using rgdal. This
>>  works fine in my local test system, but when I deploy my code to our
>>  production system I receive the following error when readOGR is executed:
>>
>>  Source: "/tmp/geojson_writer2529085113493086718.json", layer: "OGRGeoJSON"
>>  with 195 features
>>  It has 26 fields, of which 1 list fields
>>  Error : length(fldnms1) == nflds is not TRUE
>
> Pleaase run traceback() after the error.
>
> Please run ogrInfo() on both systems, and compare the output.
>
> Please check that GDAL is the same version on both systems (I guess it isn't 
> - if the file is the same on both systems, it is the only other variable 
> element). The GDAL version can be shown by:
>
> getGDALVersionInfo()
>
> and compare with:
>
> getGDALCheckVersion()
>
> to ensure that rgdal was installed using the same version as the GDAL shared 
> object that is loaded (this is shown when rgdal is loaded unless startup 
> messages are suppressed).
>
> If you check the source code - traceback() shows which function to look in - 
> you'll see that this is about the names of list fields (data fields that 
> include a list of fields of the same type). Does your input file include such 
> list fields?
>
> Hope this helps,
>
> Roger
>
>>
>>  Any ideas about what the error means?
>>
>>  My local system and the production system are using the same version of
>>  rgdal. Here is the sessionInfo for the system that is having trouble:
>> 
>> >  sessionInfo()
>>  R version 3.1.3 (2015-03-09)
>>  Platform: x86_64-redhat-linux-gnu (64-bit)
>>  Running under: CentOS release 6.5 (Final)
>>
>>  locale:
>>  [1] LC_CTYPE=en_AU.UTF-8       LC_NUMERIC=C
>>  [3] LC_TIME=en_AU.UTF-8        LC_COLLATE=en_AU.UTF-8
>>  [5] LC_MONETARY=en_AU.UTF-8    LC_MESSAGES=en_AU.UTF-8
>>  [7] LC_PAPER=en_AU.UTF-8       LC_NAME=C
>>  [9] LC_ADDRESS=C               LC_TELEPHONE=C
>>  [11] LC_MEASUREMENT=en_AU.UTF-8 LC_IDENTIFICATION=C
>>
>>  attached base packages:
>>  [1] grid      stats     graphics  grDevices utils     methods   base
>>
>>  other attached packages:
>>  [1] log4r_0.2          PBSmapping_2.69.76 rgeos_0.3-8        gpclib_1.5-5
>>  [5] maptools_0.8-36    gdata_2.16.1       RJSONIO_1.3-0      spdep_0.5-88
>>  [9] Matrix_1.1-5       rgdal_0.9-2        sp_1.1-0           Hmisc_3.16-0
>>  [13] ggplot2_1.0.1      Formula_1.2-1      survival_2.38-1
>>  lattice_0.20-30
>>  [17] psych_1.5.4        classInt_0.1-22
>>
>>  loaded via a namespace (and not attached):
>>  [1] acepack_1.3-3.3     boot_1.3-15         class_7.3-12
>>  [4] cluster_2.0.1       coda_0.17-1         colorspace_1.2-6
>>  [7] deldir_0.1-9        digest_0.6.8        e1071_1.6-4
>>  [10] foreign_0.8-63      gridExtra_0.9.1     gtable_0.1.2
>>  [13] gtools_3.4.2        latticeExtra_0.6-26 LearnBayes_2.15
>>  [16] magrittr_1.5        MASS_7.3-39         mnormt_1.5-2
>>  [19] munsell_0.4.2       nlme_3.1-120        nnet_7.3-9
>>  [22] parallel_3.1.3      plyr_1.8.2          proto_0.3-10
>>  [25] RColorBrewer_1.1-2  Rcpp_0.11.6         reshape2_1.4.1
>>  [28] rpart_4.1-9         scales_0.2.4        splines_3.1
>>
>>  Thanks.
>>  Phil
>>
>>  ---
>>  Philip Greenwood
>>  Senior Software Developer
>>  Australian Urban Research Infrastructure Network (AURIN)
>>  Level 2 West, Alice Hoy Building, University of Melbourne
>>  T: +61-(0)3-9035-8549
>>  E: philip.greenwood at unimelb.edu.au
>>
>>  _______________________________________________
>>  R-sig-Geo mailing list
>>  R-sig-Geo at r-project.org
>>  https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>> 
>
>

-- 
Roger Bivand
Department of Economics, Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; fax +47 55 95 91 00
e-mail: Roger.Bivand at nhh.no
http://orcid.org/0000-0003-2392-6140
https://scholar.google.no/citations?user=AWeghB0AAAAJ&hl=en
http://depsy.org/person/434412



More information about the R-sig-Geo mailing list