aboutsummaryrefslogtreecommitdiff
path: root/src/iso19111/c_api.cpp
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2021-10-05 19:21:05 +0200
committerGitHub <noreply@github.com>2021-10-05 19:21:05 +0200
commitc50ba1b1a7ecde946544c03ab0951727dd87264d (patch)
tree2be4d809980ba1450d6e8a2af29c4e9822c9f2d1 /src/iso19111/c_api.cpp
parent6b58adb4b7396b9c2aff2fa26aae2340d5a62d21 (diff)
parent5d6bdadfca419c1d54d455e240743791e6cea44e (diff)
downloadPROJ-c50ba1b1a7ecde946544c03ab0951727dd87264d.tar.gz
PROJ-c50ba1b1a7ecde946544c03ab0951727dd87264d.zip
Merge pull request #2876 from rouault/iau
Add IAU_2015 CRS definitions
Diffstat (limited to 'src/iso19111/c_api.cpp')
-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;