Skip to content

Commit

Permalink
proj.h: add PJ_CATEGORY_DATUM_ENSEMBLE for proj_create_from_database()
Browse files Browse the repository at this point in the history
  • Loading branch information
rouault committed Nov 1, 2020
1 parent 1e5acb0 commit 119888b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/iso19111/c_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -675,6 +675,9 @@ PJ *proj_create_from_database(PJ_CONTEXT *ctx, const char *auth_name,
codeStr, usePROJAlternativeGridNames != 0)
.as_nullable();
break;
case PJ_CATEGORY_DATUM_ENSEMBLE:
obj = factory->createDatumEnsemble(codeStr).as_nullable();
break;
}
return pj_obj_create(ctx, NN_NO_CHECK(obj));
} catch (const std::exception &e) {
Expand Down
3 changes: 2 additions & 1 deletion src/proj.h
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,8 @@ typedef enum
PJ_CATEGORY_PRIME_MERIDIAN,
PJ_CATEGORY_DATUM,
PJ_CATEGORY_CRS,
PJ_CATEGORY_COORDINATE_OPERATION
PJ_CATEGORY_COORDINATE_OPERATION,
PJ_CATEGORY_DATUM_ENSEMBLE
} PJ_CATEGORY;

/** \brief Object type. */
Expand Down
7 changes: 7 additions & 0 deletions test/unit/test_c_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -844,6 +844,13 @@ TEST_F(CApi, proj_create_from_database) {
ObjectKeeper keeper(datum);
EXPECT_EQ(proj_get_type(datum), PJ_TYPE_GEODETIC_REFERENCE_FRAME);
}
{
auto ensemble = proj_create_from_database(
m_ctxt, "EPSG", "6326", PJ_CATEGORY_DATUM_ENSEMBLE, false, nullptr);
ASSERT_NE(ensemble, nullptr);
ObjectKeeper keeper(ensemble);
EXPECT_EQ(proj_get_type(ensemble), PJ_TYPE_DATUM_ENSEMBLE);
}
{
// International Terrestrial Reference Frame 2008
auto datum = proj_create_from_database(
Expand Down

0 comments on commit 119888b

Please sign in to comment.