MCPcopy Create free account
hub / github.com/OSGeo/PROJ / proj_context_get_database_metadata

Function proj_context_get_database_metadata

src/iso19111/c_api.cpp:444–465  ·  view source on GitHub ↗

\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. * * Available keys: * * - DATABASE.LAYOUT.VERSION.MAJOR * - DATABASE.LAYOUT.VERSION.MINOR * - EPSG.VERSION * - EPSG.DATE * - ESRI.VERSION * - ESRI.DATE * - IGNF.SOURCE * - IGNF.VERSION * - IGNF.DATE * - NKG.SOURCE * - NK

Source from the content-addressed store, hash-verified

442 * @return value, or nullptr
443 */
444const char *proj_context_get_database_metadata(PJ_CONTEXT *ctx,
445 const char *key) {
446 SANITIZE_CTX(ctx);
447 if (!key) {
448 proj_context_errno_set(ctx, PROJ_ERR_OTHER_API_MISUSE);
449 proj_log_error(ctx, __FUNCTION__, "missing required input");
450 return nullptr;
451 }
452 try {
453 // temporary variable must be used as getDBcontext() might create
454 // ctx->cpp_context
455 auto osVal(getDBcontext(ctx)->getMetadata(key));
456 if (osVal == nullptr) {
457 return nullptr;
458 }
459 ctx->get_cpp_context()->lastDbMetadataItem_ = osVal;
460 return ctx->cpp_context->lastDbMetadataItem_.c_str();
461 } catch (const std::exception &e) {
462 proj_log_error(ctx, __FUNCTION__, e.what());
463 return nullptr;
464 }
465}
466
467// ---------------------------------------------------------------------------
468

Callers 3

TEST_FFunction · 0.85
proj_init_infoFunction · 0.85
mainFunction · 0.85

Calls 6

proj_context_errno_setFunction · 0.85
proj_log_errorFunction · 0.85
getDBcontextFunction · 0.85
getMetadataMethod · 0.80
get_cpp_contextMethod · 0.80
whatMethod · 0.45

Tested by 1

TEST_FFunction · 0.68