aboutsummaryrefslogtreecommitdiff
path: root/src/c_api.cpp
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2018-11-26 15:47:57 +0100
committerEven Rouault <even.rouault@spatialys.com>2018-11-29 00:35:25 +0100
commit67758b2c67ea329116b59818c038797667c4e1d1 (patch)
tree7e6b4ead6cbe9251ea5ef64d6c45179287597b2e /src/c_api.cpp
parent7e05bd0ff52fe3ba78dfd75f9ebebe3dfe715bca (diff)
downloadPROJ-67758b2c67ea329116b59818c038797667c4e1d1.tar.gz
PROJ-67758b2c67ea329116b59818c038797667c4e1d1.zip
Redirect epsg:XXXX and IGNF:XXXX CRS expansions to the database, and remove the data/epsg and data/IGNF files
Diffstat (limited to 'src/c_api.cpp')
-rw-r--r--src/c_api.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/c_api.cpp b/src/c_api.cpp
index 3b51d905..e74f4347 100644
--- a/src/c_api.cpp
+++ b/src/c_api.cpp
@@ -252,6 +252,28 @@ const char *proj_context_get_database_path(PJ_CONTEXT *ctx) {
// ---------------------------------------------------------------------------
+/** \brief Return a metadata from the database.
+ *
+ * The returned pointer remains valid while ctx is valid, and until
+ * proj_context_get_database_metadata() is called.
+ *
+ * @param ctx PROJ context, or NULL for default context
+ * @param key Metadata key. Must not be NULL
+ * @return value, or nullptr
+ */
+const char *proj_context_get_database_metadata(PJ_CONTEXT *ctx,
+ const char *key) {
+ SANITIZE_CTX(ctx);
+ try {
+ return getDBcontext(ctx)->getMetadata(key);
+ } catch (const std::exception &e) {
+ proj_log_error(ctx, __FUNCTION__, e.what());
+ return nullptr;
+ }
+}
+
+// ---------------------------------------------------------------------------
+
/** \brief Guess the "dialect" of the WKT string.
*
* @param ctx PROJ context, or NULL for default context