[R-sig-Geo] rgdal 1.2-3 on CRAN: breaking change in rgdal::readOGR()

Roger Bivand Roger.Bivand at nhh.no
Thu Nov 10 19:18:17 CET 2016


Following the question put on this list at:

https://stat.ethz.ch/pipermail/r-sig-geo/2016-October/025038.html

about the default for reading 64-bit integers using rgdal::readOGR(), a 
possibly breaking change has been made. The doodle vote came down very 
strongly in favour of changing the previous "allow.loss" default to 
"no.loss", nobody supported keeping "allow.loss".

Previously, if the int64 fitted into a signed int32, things worked, but 
broke silently if values overflowed for GDAL >= 2 (GDAL < 2 did not have 
64-bit integers). Now the default is to treat all 64-bit integers as 
strings - think of US Census block numbers. Users will see consequences 
from this if the expectation in scripts was an integer value (ASDAR code 
has been updated on the book website). See the function help page and 
examples for more details. When in doubt, use ogrInfo() to check field 
types before reading.

For some, the GDAL1_integer64_policy argument may be helpful; it is set to 
FALSE by default, but if TRUE will do what GDAL < 2 did, and return 
numeric (floating point) values when integers were specified in a field 
too wide for 32-bit integers (typically in Shapefiles where most of the 
misery - as always - occurs). If many users feel it necessary, I can add a 
once-per-session option to set this argument.

In addition, rgdal::readOGR() will no longer throw an error if the layer 
argument is missing, but will ask the data source name (dsn) argument for 
a list of layers. If only one is found, it will be used silently, if more 
than one, the first will be used and a warning given. This should 
correspond to sf::st_read().

Functions opening raster files may pass open options when linked to GDAL 
>= 2; very few drivers accept such options, but as GDAL 2 provides this 
possibility, it is now provided.

Hope this makes sense,

Roger

-- 
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