[PROJ] Switch to proj-datumgrid-geotiff for PROJ 7 ?
Even Rouault
even.rouault at spatialys.com
Thu Jan 16 16:20:30 PST 2020
Nyall,
> Could we possibly keep the api returning the grid urls from the
> existing repos, mark that api as deprecated, and then add new api to
> get the new geotiff download urls?
That would not be only at the API level. We would also need to keep for each
grid in the database a location for the old package, and for the new API. That
doesn't sound very good to me that we set in-stone past behaviour.
> Otherwise this is a functional
> break for clients, and I'd rather it became a hard-compilation failure
> then a silent change in behaviour.
Technically, this is not an API break. The PROJ 6 API already has a provision
for this case.
If you look at
int PROJ_DLL proj_coordoperation_get_grid_used(PJ_CONTEXT *ctx,
const PJ *coordoperation,
int index,
const char **out_short_name,
const char **out_full_name,
const char **out_package_name,
const char **out_url,
int *out_direct_download,
int *out_open_license,
int *out_available);
then when *out_package_name might actually be an empty string, and *out_url is
then mean to be the URL of the grid to download, and not the URL of a package.
The PROJ6 database has actually already 2 entries following this for the
Netherlands / RDNAP grids, such as
INSERT INTO grid_alternatives(original_grid_name,
proj_grid_name,
proj_grid_format,
proj_method,
inverse_direction,
package_name,
url, direct_download, open_license, directory)
VALUES ('rdtrans2008.gsb',
'rdtrans2008.gsb',
'NTv2',
'hgridshift',
0,
NULL, -- package name
'https://salsa.debian.org/debian-gis-team/proj-rdnap/raw/upstream/2008/rdtrans2008.gsb',
1, -- direct download
0, -- non-freely licensed. See https://
salsa.debian.org/debian-gis-team/proj-rdnap/raw/master/debian/copyright
NULL);
The output of
"""
#include <stdio.h>
#include "proj.h"
int main(void) {
PJ_CONTEXT *ctx = proj_context_create();
auto op = proj_create_from_database(ctx, "EPSG", "7000",
PJ_CATEGORY_COORDINATE_OPERATION,
true,
nullptr);
const char *shortName = nullptr;
const char *fullName = nullptr;
const char *packageName = nullptr;
const char *url = nullptr;
int directDownload = 0;
int openLicense = 0;
int available = 0;
proj_coordoperation_get_grid_used(
ctx, op, 0, &shortName, &fullName, &packageName, &url,
&directDownload, &openLicense, &available);
printf("packageName = '%s'\n", packageName);
printf("url = '%s'\n", url);
printf("directDownload = %d\n", directDownload);
return 0;
}
"""
with PROJ 6.3 (and earlier) is
packageName = ''
url = 'https://salsa.debian.org/debian-gis-team/proj-rdnap/raw/upstream/2008/
rdtrans2008.gsb'
directDownload = 1
So, although admitedly the exception currently, the behaviour I propose in the
document and that would become the general rule, can already happen.
Even
--
Spatialys - Geospatial professional services
http://www.spatialys.com
More information about the PROJ
mailing list