[gdal-dev] GDAL 3, PROJ 6.2 exportToProj4() drops Datum silently

Roger Bivand Roger.Bivand at nhh.no
Tue Oct 29 07:30:41 PDT 2019


In looking at ways to adapt R packages rgdal and sf to current GDAL and 
PROJ, I have run into a problem. Many existing vector files (I have not 
yet looked at raster) include a datum declaration, which is still present 
internally in the OGRSpatialReference object, but is dropped in the output 
of exportToProj4().

I realise that datums are not a good idea going forward, but the 
consequence is a regression from PROJ 4 and GDAL 2 where transformation 
could rely on the +datum tag being in the PROJ string. A use case with 
b_pump.* (in reprex.zip) is used in 
https://github.com/r-spatial/sf/issues/1146 and linking to discussion on 
https://github.com/r-spatial/discuss/issues/28. I have not looked at other 
drivers than ESRI Shapefile yet, I'd need to generate fresh examples that 
were definitely created on a PROJ 4 / GDAL 2 system.

The point (John Snow's Broad Street pump) used to land on Web Mercator 
close to the right place, but because the datum is dropped on export to 
PROJ, transformation is only with ballpark accuracy now. I can see that 
proj_to_proj_string() gets called, but do not see any options providing 
backward compatibility (what to do if a deprecated tag is not empty).

Using GetAttrValue("DATUM"), I can alert users who bother to see warnings 
that something has happened requiring their attention, but am I missing a 
CPL option or other remedy already in place?

Optional interpolation from GDALs gt_datum.csv or similar would perhaps 
help, inserting a +towgs84 tag, but I do not have a clear view how to make 
the migration process for users easier. In any case, they will need to 
provide an EPSG or urn or similar look-up string in the future, but this 
isn't predictably stored or retrievable.

Grateful for input,

Roger

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


More information about the gdal-dev mailing list