[PROJ] Odd 6.3.0RC1 issue

Roger Bivand Roger.Bivand at nhh.no
Mon Dec 30 09:52:27 PST 2019


On Mon, 30 Dec 2019, Roger Bivand wrote:

> On Mon, 30 Dec 2019, Even Rouault wrote:
>
>>>  You can't. GetAttrValue() is about asking value of WKT(1) nodes, of
>>>  PROJ.4
>>>  string
>>
>>  I meant *not parts* of PROJ.4 string
>> 
>
> No, but I can (and do) retreive DATUM and TOWGS84 from objects instantiated 
> when reading vector files to check whether they vanish from proj4 strings.
>
> Status is that legacy R-sp-workflows and modern R-sf-workflows will move to 
> WKT2 as the internal CRS representation, but in the R-sp-workflow case, PROJ4 
> strings must be retained too, even though the WKT2 representations will be 
> used for transformation and file export. PROJ4 strings are also needed to 
> define CRS.
>
> Here I'm just reporting a very puzzling issue. Checking across some other 
> EPSG, it seems to affect EPSG:27700 (the Snow Soho Cholera data set, the 
> Scottish lip cancer data set), and not in all contexts. However, the problem 
> was not present with 6.2.1, and is now.

Code:

#include <stdio.h>
#include "ogrsf_frmts.h"
#include <ogr_spatialref.h>

int main() {

   OGRSpatialReference hSRS = (OGRSpatialReference) NULL;
   char *pszSRS = NULL, *wkt = NULL;
   const char *datum, *ellps;
   hSRS.importFromEPSG(27700);
   datum = hSRS.GetAttrValue("DATUM");
   printf("datum: %s\n", datum);
   ellps = hSRS.GetAttrValue("DATUM|SPHEROID");
   printf("ellps: %s\n", ellps);
   hSRS.exportToProj4(&pszSRS);
   printf("PROJ4: %s\n", pszSRS);
   hSRS.exportToWkt(&wkt);
   printf("WKT2: %s\n", wkt);
   exit(0);
}

This performs correctly for me, 6.3.0RC1, GDAL master from about 13:30 
today (git has no revision numbers). So there must be a fragility in my 
code somewhere, that something in 6.3.0RC1 has exposed, but that is 
unknown and mostly 27700 at the moment as far as I can see - other 
discarded datums seem to try to inject a towgs84 or similar.

Roger

>
> 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 PROJ mailing list