aboutsummaryrefslogtreecommitdiff
path: root/src/iso19111
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2021-09-28 15:09:24 +0200
committerEven Rouault <even.rouault@spatialys.com>2021-09-28 16:37:39 +0200
commit5d6bdadfca419c1d54d455e240743791e6cea44e (patch)
tree44df729735c6044936e37795fe089905672f51df /src/iso19111
parentf13c584c057dd9866284deb2cb646e507df0b4bb (diff)
downloadPROJ-5d6bdadfca419c1d54d455e240743791e6cea44e.tar.gz
PROJ-5d6bdadfca419c1d54d455e240743791e6cea44e.zip
projinfo --list-crs / proj_get_crs_info_list_from_database(): make it work with IAU generic authority name
Diffstat (limited to 'src/iso19111')
-rw-r--r--src/iso19111/c_api.cpp19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/iso19111/c_api.cpp b/src/iso19111/c_api.cpp
index a5e1bc81..9493452c 100644
--- a/src/iso19111/c_api.cpp
+++ b/src/iso19111/c_api.cpp
@@ -2766,10 +2766,19 @@ proj_get_crs_info_list_from_database(PJ_CONTEXT *ctx, const char *auth_name,
PROJ_CRS_INFO **ret = nullptr;
int i = 0;
try {
- auto factory = AuthorityFactory::create(getDBcontext(ctx),
- auth_name ? auth_name : "");
- auto list = factory->getCRSInfoList();
- ret = new PROJ_CRS_INFO *[list.size() + 1];
+ auto dbContext = getDBcontext(ctx);
+ const std::string authName = auth_name ? auth_name : "";
+ auto actualAuthNames =
+ dbContext->getVersionedAuthoritiesFromName(authName);
+ if (actualAuthNames.empty())
+ actualAuthNames.push_back(authName);
+ std::list<AuthorityFactory::CRSInfo> concatList;
+ for (const auto &actualAuthName : actualAuthNames) {
+ auto factory = AuthorityFactory::create(dbContext, actualAuthName);
+ auto list = factory->getCRSInfoList();
+ concatList.splice(concatList.end(), std::move(list));
+ }
+ ret = new PROJ_CRS_INFO *[concatList.size() + 1];
GeographicBoundingBoxPtr bbox;
if (params && params->bbox_valid) {
bbox = GeographicBoundingBox::create(
@@ -2777,7 +2786,7 @@ proj_get_crs_info_list_from_database(PJ_CONTEXT *ctx, const char *auth_name,
params->east_lon_degree, params->north_lat_degree)
.as_nullable();
}
- for (const auto &info : list) {
+ for (const auto &info : concatList) {
auto type = PJ_TYPE_CRS;
if (info.type == AuthorityFactory::ObjectType::GEOGRAPHIC_2D_CRS) {
type = PJ_TYPE_GEOGRAPHIC_2D_CRS;