aboutsummaryrefslogtreecommitdiff
path: root/src/iso19111/factory.cpp
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2020-01-29 12:51:49 +0100
committerGitHub <noreply@github.com>2020-01-29 12:51:49 +0100
commitbf6b1a889b12d7ecdcb190cd14155e09e132095f (patch)
treef742983990ca914ff3044352efd4e01eef5bd01d /src/iso19111/factory.cpp
parent74a10a8de03deb823690f143e191087bf7c4821f (diff)
parentb113d0825cf82f66f738746db0f21745017552e9 (diff)
downloadPROJ-bf6b1a889b12d7ecdcb190cd14155e09e132095f.tar.gz
PROJ-bf6b1a889b12d7ecdcb190cd14155e09e132095f.zip
Merge pull request #1891 from rouault/rfc5
Implement RFC5: Adopt GeoTIFF-based grids for grids delivered with PROJ
Diffstat (limited to 'src/iso19111/factory.cpp')
-rw-r--r--src/iso19111/factory.cpp27
1 files changed, 26 insertions, 1 deletions
diff --git a/src/iso19111/factory.cpp b/src/iso19111/factory.cpp
index 7e680d31..54aa993f 100644
--- a/src/iso19111/factory.cpp
+++ b/src/iso19111/factory.cpp
@@ -987,7 +987,8 @@ bool DatabaseContext::lookForGridInfo(
openLicense = (row[3].empty() ? row[4] : row[3]) == "1";
directDownload = (row[5].empty() ? row[6] : row[5]) == "1";
- if (considerKnownGridsAsAvailable && !packageName.empty()) {
+ if (considerKnownGridsAsAvailable &&
+ (!packageName.empty() || (!url.empty() && openLicense))) {
gridAvailable = true;
}
@@ -1012,6 +1013,30 @@ bool DatabaseContext::isKnownName(const std::string &name,
sql += "\" WHERE name = ? LIMIT 1";
return !d->run(sql, {name}).empty();
}
+// ---------------------------------------------------------------------------
+
+std::string
+DatabaseContext::getProjGridName(const std::string &oldProjGridName) {
+ auto res = d->run("SELECT proj_grid_name FROM grid_alternatives WHERE "
+ "old_proj_grid_name = ?",
+ {oldProjGridName});
+ if (res.empty()) {
+ return std::string();
+ }
+ return res.front()[0];
+}
+
+// ---------------------------------------------------------------------------
+
+std::string DatabaseContext::getOldProjGridName(const std::string &gridName) {
+ auto res = d->run("SELECT old_proj_grid_name FROM grid_alternatives WHERE "
+ "proj_grid_name = ?",
+ {gridName});
+ if (res.empty()) {
+ return std::string();
+ }
+ return res.front()[0];
+}
// ---------------------------------------------------------------------------