diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2020-01-28 12:03:20 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-01-28 12:03:20 +0100 |
| commit | f2efd1d73c6c56531280604fd27c73fb13b41206 (patch) | |
| tree | 93b2016db24e875ccebb43abcd2de43a41d1f698 /src/apps | |
| parent | a4c5cc1e42559f1d92c6b7655680d11f1eead703 (diff) | |
| parent | 15814256e2fbbc2702422fd3d09d3a0f6be60006 (diff) | |
| download | PROJ-f2efd1d73c6c56531280604fd27c73fb13b41206.tar.gz PROJ-f2efd1d73c6c56531280604fd27c73fb13b41206.zip | |
Merge pull request #1892 from rouault/add_projinfo_searchpaths
projinfo: add --searchpaths switch
Diffstat (limited to 'src/apps')
| -rw-r--r-- | src/apps/projinfo.cpp | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/src/apps/projinfo.cpp b/src/apps/projinfo.cpp index 27ea278a..9cd9b2ee 100644 --- a/src/apps/projinfo.cpp +++ b/src/apps/projinfo.cpp @@ -98,8 +98,9 @@ static void usage() { << std::endl << " [--identify] [--3d]" << std::endl << " [--c-ify] [--single-line]" << std::endl - << " {object_definition} | (-s {srs_def} -t {srs_def})" - << std::endl; + << " --searchpaths | --remote-data | " + "{object_definition} |" + << " (-s {srs_def} -t {srs_def})" << std::endl; std::cerr << std::endl; std::cerr << "-o: formats is a comma separated combination of: " "all,default,PROJ,WKT_ALL,WKT2:2015,WKT2:2019,WKT1:GDAL," @@ -1057,6 +1058,34 @@ int main(int argc, char **argv) { outputOpt.strict = false; } else if (ci_equal(arg, "--3d")) { promoteTo3D = true; + } else if (ci_equal(arg, "--searchpaths")) { +#ifdef _WIN32 + constexpr char delim = ';'; +#else + constexpr char delim = ':'; +#endif + const auto paths = split(proj_info().searchpath, delim); + for (const auto &path : paths) { + std::cout << path << std::endl; + } + std::exit(0); + } else if (ci_equal(arg, "--remote-data")) { +#ifdef CURL_ENABLED + if (pj_context_is_network_enabled(nullptr)) { + std::cout << "Status: enabled" << std::endl; + std::cout << "URL: " << pj_context_get_url_endpoint(nullptr) + << std::endl; + } else { + std::cout << "Status: disabled" << std::endl; + std::cout << "Reason: not enabled in proj.ini or " + "PROJ_NETWORK=ON not specified" + << std::endl; + } +#else + std::cout << "Status: disabled" << std::endl; + std::cout << "Reason: build without Curl support" << std::endl; +#endif + std::exit(0); } else if (arg == "-?" || arg == "--help") { usage(); } else if (arg[0] == '-') { |
