diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2020-12-02 17:12:54 +0100 |
|---|---|---|
| committer | Even Rouault <even.rouault@spatialys.com> | 2020-12-02 21:11:41 +0100 |
| commit | 18ab7ef2e357e0c01464848a6911e754ebca471f (patch) | |
| tree | 81aeb97f98f6e4be479e2ec2b9aed1678b2c326d /src/apps | |
| parent | ebe00831b7d6de3aae01ddd5f3074e53ac6d981e (diff) | |
| download | PROJ-18ab7ef2e357e0c01464848a6911e754ebca471f.tar.gz PROJ-18ab7ef2e357e0c01464848a6911e754ebca471f.zip | |
cs2cs / proj_create_crs_to_crs_from_pj(): add a --authority switch to control where coordinate operations are looked for (fixes #2442)
Diffstat (limited to 'src/apps')
| -rw-r--r-- | src/apps/cs2cs.cpp | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/apps/cs2cs.cpp b/src/apps/cs2cs.cpp index dd65baf4..409a5ef3 100644 --- a/src/apps/cs2cs.cpp +++ b/src/apps/cs2cs.cpp @@ -77,6 +77,7 @@ static const char *oterr = "*\t*"; /* output line for unprojectable input */ static const char *usage = "%s\nusage: %s [-dDeEfIlrstvwW [args]]\n" " [[--area name_or_code] | [--bbox west_long,south_lat,east_long,north_lat]]\n" + " [--authority {name}]\n" " [+opt[=arg] ...] [+to +opt[=arg] ...] [file ...]\n"; static double (*informat)(const char *, @@ -372,6 +373,7 @@ int main(int argc, char **argv) { ExtentPtr bboxFilter; std::string area; + const char* authority = nullptr; /* process run line arguments */ while (--argc > 0) { /* collect run line arguments */ @@ -410,6 +412,15 @@ int main(int argc, char **argv) { std::exit(1); } } + else if (strcmp(*argv, "--authority") == 0 ) { + ++argv; + --argc; + if( argc == 0 ) { + emess(1, "missing argument for --authority"); + std::exit(1); + } + authority = *argv; + } else if (**argv == '-') { for (arg = *argv;;) { switch (*++arg) { @@ -761,8 +772,15 @@ int main(int argc, char **argv) { } } + std::string authorityOption; /* keep this variable in this outer scope ! */ + const char* options[2] = { nullptr, nullptr }; + if( authority ) { + authorityOption = "AUTHORITY="; + authorityOption += authority; + options[0] = authorityOption.data(); + } transformation = proj_create_crs_to_crs_from_pj(nullptr, src, dst, - pj_area, nullptr); + pj_area, options); proj_destroy(src); proj_destroy(dst); |
