aboutsummaryrefslogtreecommitdiff
path: root/src/apps/projinfo.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/apps/projinfo.cpp')
-rw-r--r--src/apps/projinfo.cpp78
1 files changed, 42 insertions, 36 deletions
diff --git a/src/apps/projinfo.cpp b/src/apps/projinfo.cpp
index 5dfc4f72..add4119d 100644
--- a/src/apps/projinfo.cpp
+++ b/src/apps/projinfo.cpp
@@ -968,7 +968,7 @@ int main(int argc, char **argv) {
double minimumAccuracy = -1;
bool outputAll = false;
bool dumpDbStructure = false;
- std::string listCRS;
+ std::string listCRSFilter;
bool listCRSSpecified = false;
for (int i = 1; i < argc; i++) {
@@ -1251,7 +1251,7 @@ int main(int argc, char **argv) {
listCRSSpecified = true;
if (i + 1 < argc && argv[i + 1][0] != '-') {
i++;
- listCRS = argv[i];
+ listCRSFilter = argv[i];
}
} else if (ci_equal(arg, "--searchpaths")) {
#ifdef _WIN32
@@ -1354,11 +1354,11 @@ int main(int argc, char **argv) {
if (listCRSSpecified) {
bool allow_deprecated = false;
std::set<AuthorityFactory::ObjectType> types;
- auto tokens = split(listCRS, ',');
- if (listCRS.empty()) {
+ auto tokens = split(listCRSFilter, ',');
+ if (listCRSFilter.empty()) {
tokens.clear();
}
- for (auto token : tokens) {
+ for (const auto &token : tokens) {
if (ci_equal(token, "allow_deprecated")) {
allow_deprecated = true;
} else if (ci_equal(token, "geodetic")) {
@@ -1397,44 +1397,50 @@ int main(int argc, char **argv) {
}
for (const auto &auth_name : allowedAuthorities) {
try {
- auto factory =
- AuthorityFactory::create(NN_NO_CHECK(dbContext), auth_name);
- const auto list = factory->getCRSInfoList();
- for (const auto &info : list) {
- if (!allow_deprecated && info.deprecated) {
- continue;
- }
- if (!types.empty() &&
- types.find(info.type) == types.end()) {
- continue;
- }
- if (bboxFilter) {
- if (!info.bbox_valid) {
+ auto actualAuthNames =
+ dbContext->getVersionedAuthoritiesFromName(auth_name);
+ if (actualAuthNames.empty())
+ actualAuthNames.push_back(auth_name);
+ for (const auto &actualAuthName : actualAuthNames) {
+ auto factory = AuthorityFactory::create(
+ NN_NO_CHECK(dbContext), actualAuthName);
+ const auto list = factory->getCRSInfoList();
+ for (const auto &info : list) {
+ if (!allow_deprecated && info.deprecated) {
+ continue;
+ }
+ if (!types.empty() &&
+ types.find(info.type) == types.end()) {
continue;
}
- auto crsExtent = Extent::createFromBBOX(
- info.west_lon_degree, info.south_lat_degree,
- info.east_lon_degree, info.north_lat_degree);
- if (spatialCriterion ==
- CoordinateOperationContext::SpatialCriterion::
- STRICT_CONTAINMENT) {
- if (!bboxFilter->contains(crsExtent)) {
+ if (bboxFilter) {
+ if (!info.bbox_valid) {
continue;
}
- } else {
- if (!bboxFilter->intersects(crsExtent)) {
- continue;
+ auto crsExtent = Extent::createFromBBOX(
+ info.west_lon_degree, info.south_lat_degree,
+ info.east_lon_degree, info.north_lat_degree);
+ if (spatialCriterion ==
+ CoordinateOperationContext::SpatialCriterion::
+ STRICT_CONTAINMENT) {
+ if (!bboxFilter->contains(crsExtent)) {
+ continue;
+ }
+ } else {
+ if (!bboxFilter->intersects(crsExtent)) {
+ continue;
+ }
}
+ } else if (!area.empty() &&
+ tolower(info.areaName).find(areaLower) ==
+ std::string::npos) {
+ continue;
}
- } else if (!area.empty() &&
- tolower(info.areaName).find(areaLower) ==
- std::string::npos) {
- continue;
+ std::cout << info.authName << ":" << info.code << " \""
+ << info.name << "\""
+ << (info.deprecated ? " [deprecated]" : "")
+ << std::endl;
}
- std::cout << info.authName << ":" << info.code << " \""
- << info.name << "\""
- << (info.deprecated ? " [deprecated]" : "")
- << std::endl;
}
} catch (const std::exception &e) {
std::cerr << "ERROR: list-crs failed with: " << e.what()