diff options
| -rw-r--r-- | include/proj/coordinatesystem.hpp | 3 | ||||
| -rw-r--r-- | src/c_api.cpp | 4 | ||||
| -rw-r--r-- | src/coordinatesystem.cpp | 21 | ||||
| -rw-r--r-- | src/io.cpp | 4 | ||||
| -rw-r--r-- | src/proj_experimental.h | 2 | ||||
| -rw-r--r-- | test/unit/test_c_api.cpp | 6 |
6 files changed, 40 insertions, 0 deletions
diff --git a/include/proj/coordinatesystem.hpp b/include/proj/coordinatesystem.hpp index 12c3e487..1a8f61cd 100644 --- a/include/proj/coordinatesystem.hpp +++ b/include/proj/coordinatesystem.hpp @@ -491,6 +491,9 @@ class PROJ_GCC_DLL CartesianCS final : public CoordinateSystem { createSouthPoleEastingNorthNorthingNorth(const common::UnitOfMeasure &unit); PROJ_DLL static CartesianCSNNPtr + createWestingSouthing(const common::UnitOfMeasure &unit); + + PROJ_DLL static CartesianCSNNPtr createGeocentric(const common::UnitOfMeasure &unit); PROJ_PRIVATE : diff --git a/src/c_api.cpp b/src/c_api.cpp index a11d5a9b..0f189eaa 100644 --- a/src/c_api.cpp +++ b/src/c_api.cpp @@ -2989,6 +2989,10 @@ PJ_OBJ *proj_obj_create_cartesian_2D_cs(PJ_CONTEXT *ctx, return PJ_OBJ::create( CartesianCS::createSouthPoleEastingNorthNorthingNorth( createLinearUnit(unit_name, unit_conv_factor))); + + case PJ_CART2D_WESTING_SOUTHING: + return PJ_OBJ::create(CartesianCS::createWestingSouthing( + createLinearUnit(unit_name, unit_conv_factor))); } } catch (const std::exception &e) { proj_log_error(ctx, __FUNCTION__, e.what()); diff --git a/src/coordinatesystem.cpp b/src/coordinatesystem.cpp index b274f583..a3ad04e0 100644 --- a/src/coordinatesystem.cpp +++ b/src/coordinatesystem.cpp @@ -947,6 +947,27 @@ CartesianCS::createNorthingEasting(const common::UnitOfMeasure &unit) { // --------------------------------------------------------------------------- +/** \brief Instanciate a CartesianCS with a Westing (first) and Southing + * (second) axis. + * + * @param unit Linear unit of the axes. + * @return a new CartesianCS. + */ +CartesianCSNNPtr +CartesianCS::createWestingSouthing(const common::UnitOfMeasure &unit) { + return create(util::PropertyMap(), + CoordinateSystemAxis::create( + util::PropertyMap().set(IdentifiedObject::NAME_KEY, + AxisName::Easting), + AxisAbbreviation::Y, AxisDirection::WEST, unit), + CoordinateSystemAxis::create( + util::PropertyMap().set(IdentifiedObject::NAME_KEY, + AxisName::Northing), + AxisAbbreviation::X, AxisDirection::SOUTH, unit)); +} + +// --------------------------------------------------------------------------- + /** \brief Instanciate a CartesianCS, north-pole centered, * with a Easting (first) South-Oriented and * Northing (second) South-Oriented axis. @@ -3514,6 +3514,10 @@ WKTParser::Private::buildProjectedCRS(const WKTNodeNNPtr &node) { linearUnit) .as_nullable(); } + } else if (methodCode == + EPSG_CODE_METHOD_TRANSVERSE_MERCATOR_SOUTH_ORIENTATED) { + cartesianCS = + CartesianCS::createWestingSouthing(linearUnit).as_nullable(); } } if (!cartesianCS) { diff --git a/src/proj_experimental.h b/src/proj_experimental.h index aeee4e5b..c575b9ae 100644 --- a/src/proj_experimental.h +++ b/src/proj_experimental.h @@ -105,6 +105,8 @@ typedef enum PJ_CART2D_NORTH_POLE_EASTING_SOUTH_NORTHING_SOUTH, /* South Pole Easting/NORTH-Norting/NORTH */ PJ_CART2D_SOUTH_POLE_EASTING_NORTH_NORTHING_NORTH, + /* Westing-southing */ + PJ_CART2D_WESTING_SOUTHING, } PJ_CARTESIAN_CS_2D_TYPE; PJ_OBJ PROJ_DLL *proj_obj_create_cartesian_2D_cs(PJ_CONTEXT *ctx, diff --git a/test/unit/test_c_api.cpp b/test/unit/test_c_api.cpp index d53f38fd..f1cf3417 100644 --- a/test/unit/test_c_api.cpp +++ b/test/unit/test_c_api.cpp @@ -2695,6 +2695,12 @@ TEST_F(CApi, proj_obj_create_cartesian_2D_cs) { ObjectKeeper keeper_cs(cs); ASSERT_NE(cs, nullptr); } + { + auto cs = proj_obj_create_cartesian_2D_cs( + m_ctxt, PJ_CART2D_WESTING_SOUTHING, nullptr, 0); + ObjectKeeper keeper_cs(cs); + ASSERT_NE(cs, nullptr); + } } } // namespace |
