Le 11/02/2022 à 18:24, Paul Harwood a écrit :
I have an application that uses GDAL with Proj Networking set on.
This is a cross platform application. It works on some platforms but
on mac (for instance) I get runtime errors like this
GDAL failure (1) PROJ: Cannot open
https://cdn.proj.org/us_nga_egm96_15.tif: error setting certificate
file: xxx/cacert.pem
Proj is looking in the wrong place for the cacert file - which is in
the proj search path. I would rather avoid using environment
variables (complicated). Is there a programmatic way to set the Proj
cacert location or a default location?
currently - the following are set
Gdal.SetConfigOption("CURL_CA_BUNDLE", Path.Combine(gdalData,
"cacert.pem"));
The logic in PROJ is:
// Custom path to SSL certificates.
if (ca_bundle_path == nullptr) {
ca_bundle_path = getenv("PROJ_CURL_CA_BUNDLE");
}
if (ca_bundle_path == nullptr) {
// Name of environment variable used by the curl binary
ca_bundle_path = getenv("CURL_CA_BUNDLE");
}
if (ca_bundle_path == nullptr) {
// Name of environment variable used by the curl binary (tested
// after CURL_CA_BUNDLE
ca_bundle_path = getenv("SSL_CERT_FILE");
}
if (ca_bundle_path != nullptr) {
CHECK_RET(ctx,
curl_easy_setopt(handle, CURLOPT_CAINFO,
ca_bundle_path));
}
There's no programmatic way, at least currently. You need to set a real
environment variable . CPLSetConfigOption() has no effect on PROJ, only
on GDAL
Osr.SetPROJSearchPath(projData);
Osr.SetPROJEnableNetwork(true);
_______________________________________________
gdal-dev mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/gdal-dev
--
http://www.spatialys.com
My software is free, but my time generally not.
_______________________________________________
gdal-dev mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/gdal-dev