aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/proj/coordinateoperation.hpp9
-rw-r--r--include/proj/internal/coordinateoperation_constants.hpp15
-rw-r--r--src/c_api.cpp36
-rw-r--r--src/coordinateoperation.cpp30
-rw-r--r--src/proj_experimental.h11
-rw-r--r--test/unit/test_c_api.cpp7
-rw-r--r--test/unit/test_operation.cpp46
7 files changed, 144 insertions, 10 deletions
diff --git a/include/proj/coordinateoperation.hpp b/include/proj/coordinateoperation.hpp
index f5cdbba0..4ab25d86 100644
--- a/include/proj/coordinateoperation.hpp
+++ b/include/proj/coordinateoperation.hpp
@@ -1082,6 +1082,15 @@ class PROJ_GCC_DLL Conversion : public SingleOperation {
const common::Length &eastingProjectionCentre,
const common::Length &northingProjectionCentre);
+ PROJ_DLL static ConversionNNPtr
+ createLabordeObliqueMercator(const util::PropertyMap &properties,
+ const common::Angle &latitudeProjectionCentre,
+ const common::Angle &longitudeProjectionCentre,
+ const common::Angle &azimuthInitialLine,
+ const common::Scale &scale,
+ const common::Length &falseEasting,
+ const common::Length &falseNorthing);
+
PROJ_DLL static ConversionNNPtr createInternationalMapWorldPolyconic(
const util::PropertyMap &properties, const common::Angle &centerLong,
const common::Angle &latitudeFirstParallel,
diff --git a/include/proj/internal/coordinateoperation_constants.hpp b/include/proj/internal/coordinateoperation_constants.hpp
index d5495193..2e29e767 100644
--- a/include/proj/internal/coordinateoperation_constants.hpp
+++ b/include/proj/internal/coordinateoperation_constants.hpp
@@ -276,11 +276,6 @@ static const ParamMapping paramLonCentreLonCenterLonc = {
EPSG_CODE_PARAMETER_LONGITUDE_PROJECTION_CENTRE, WKT1_LONGITUDE_OF_CENTER,
common::UnitOfMeasure::Type::ANGULAR, lonc};
-static const ParamMapping paramLatCentreLatOrigin = {
- EPSG_NAME_PARAMETER_LATITUDE_PROJECTION_CENTRE,
- EPSG_CODE_PARAMETER_LATITUDE_PROJECTION_CENTRE, WKT1_LATITUDE_OF_ORIGIN,
- common::UnitOfMeasure::Type::ANGULAR, lat_0};
-
static const ParamMapping paramAzimuth = {
EPSG_NAME_PARAMETER_AZIMUTH_INITIAL_LINE,
EPSG_CODE_PARAMETER_AZIMUTH_INITIAL_LINE, WKT1_AZIMUTH,
@@ -478,16 +473,16 @@ static const ParamMapping *const paramsLoxim[] = {
static const ParamMapping paramLonCentre = {
EPSG_NAME_PARAMETER_LONGITUDE_PROJECTION_CENTRE,
- EPSG_CODE_PARAMETER_LONGITUDE_PROJECTION_CENTRE, nullptr,
+ EPSG_CODE_PARAMETER_LONGITUDE_PROJECTION_CENTRE, WKT1_LONGITUDE_OF_CENTER,
common::UnitOfMeasure::Type::ANGULAR, lon_0};
static const ParamMapping paramLabordeObliqueMercatorAzimuth = {
EPSG_NAME_PARAMETER_AZIMUTH_INITIAL_LINE,
- EPSG_CODE_PARAMETER_AZIMUTH_INITIAL_LINE, nullptr,
+ EPSG_CODE_PARAMETER_AZIMUTH_INITIAL_LINE, WKT1_AZIMUTH,
common::UnitOfMeasure::Type::ANGULAR, "azi"};
static const ParamMapping *const paramsLabordeObliqueMercator[] = {
- &paramLatCentreLatOrigin,
+ &paramLatCentreLatCenter,
&paramLonCentre,
&paramLabordeObliqueMercatorAzimuth,
&paramScaleFactorInitialLine,
@@ -758,8 +753,8 @@ static const MethodMapping methodMappings[] = {
"eqearth", nullptr, paramsLonNatOrigin},
{EPSG_NAME_METHOD_LABORDE_OBLIQUE_MERCATOR,
- EPSG_CODE_METHOD_LABORDE_OBLIQUE_MERCATOR, nullptr, "labrd", nullptr,
- paramsLabordeObliqueMercator},
+ EPSG_CODE_METHOD_LABORDE_OBLIQUE_MERCATOR, "Laborde_Oblique_Mercator",
+ "labrd", nullptr, paramsLabordeObliqueMercator},
};
diff --git a/src/c_api.cpp b/src/c_api.cpp
index 496312f7..e5ceca7d 100644
--- a/src/c_api.cpp
+++ b/src/c_api.cpp
@@ -4265,6 +4265,42 @@ proj_obj_create_conversion_hotine_oblique_mercator_two_point_natural_origin(
}
// ---------------------------------------------------------------------------
+/** \brief Instanciate a ProjectedCRS with a conversion based on the Laborde
+ * Oblique Mercator projection method.
+ *
+ * See
+ * osgeo::proj::operation::Conversion::createLabordeObliqueMercator().
+ *
+ * Linear parameters are expressed in (linear_unit_name,
+ * linear_unit_conv_factor).
+ * Angular parameters are expressed in (ang_unit_name, ang_unit_conv_factor).
+ */
+PJ_OBJ *proj_obj_create_conversion_laborde_oblique_mercator(
+ PJ_CONTEXT *ctx, double latitude_projection_centre,
+ double longitude_projection_centre, double azimuth_initial_line,
+ double scale, double false_easting, double false_northing,
+ const char *ang_unit_name, double ang_unit_conv_factor,
+ const char *linear_unit_name, double linear_unit_conv_factor) {
+ SANITIZE_CTX(ctx);
+ try {
+ UnitOfMeasure linearUnit(
+ createLinearUnit(linear_unit_name, linear_unit_conv_factor));
+ UnitOfMeasure angUnit(
+ createAngularUnit(ang_unit_name, ang_unit_conv_factor));
+ auto conv = Conversion::createLabordeObliqueMercator(
+ PropertyMap(), Angle(latitude_projection_centre, angUnit),
+ Angle(longitude_projection_centre, angUnit),
+ Angle(azimuth_initial_line, angUnit), Scale(scale),
+ Length(false_easting, linearUnit),
+ Length(false_northing, linearUnit));
+ return proj_obj_create_conversion(conv);
+ } catch (const std::exception &e) {
+ proj_log_error(ctx, __FUNCTION__, e.what());
+ }
+ return nullptr;
+}
+// ---------------------------------------------------------------------------
+
/** \brief Instanciate a ProjectedCRS with a conversion based on the
* International Map of the World Polyconic projection method.
*
diff --git a/src/coordinateoperation.cpp b/src/coordinateoperation.cpp
index 654692fb..ac2c4196 100644
--- a/src/coordinateoperation.cpp
+++ b/src/coordinateoperation.cpp
@@ -3267,6 +3267,36 @@ ConversionNNPtr Conversion::createHotineObliqueMercatorTwoPointNaturalOrigin(
// ---------------------------------------------------------------------------
+/** \brief Instanciate a conversion based on the [Laborde Oblique Mercator]
+ *(https://proj4.org/operations/projections/labrd.html) projection method.
+ *
+ * This method is defined as [EPSG:9813]
+ * (https://www.epsg-registry.org/export.htm?gml=urn:ogc:def:method:EPSG::9813)
+ *
+ * @param properties See \ref general_properties of the conversion. If the name
+ * is not provided, it is automatically set.
+ * @param latitudeProjectionCentre See \ref latitude_projection_centre
+ * @param longitudeProjectionCentre See \ref longitude_projection_centre
+ * @param azimuthInitialLine See \ref azimuth_initial_line
+ * @param scale See \ref scale_factor_initial_line
+ * @param falseEasting See \ref false_easting
+ * @param falseNorthing See \ref false_northing
+ * @return a new Conversion.
+ */
+ConversionNNPtr Conversion::createLabordeObliqueMercator(
+ const util::PropertyMap &properties,
+ const common::Angle &latitudeProjectionCentre,
+ const common::Angle &longitudeProjectionCentre,
+ const common::Angle &azimuthInitialLine, const common::Scale &scale,
+ const common::Length &falseEasting, const common::Length &falseNorthing) {
+ return create(properties, EPSG_CODE_METHOD_LABORDE_OBLIQUE_MERCATOR,
+ createParams(latitudeProjectionCentre,
+ longitudeProjectionCentre, azimuthInitialLine,
+ scale, falseEasting, falseNorthing));
+}
+
+// ---------------------------------------------------------------------------
+
/** \brief Instanciate a conversion based on the [International Map of the World
*Polyconic]
*(https://proj4.org/operations/projections/imw_p.html) projection method.
diff --git a/src/proj_experimental.h b/src/proj_experimental.h
index 698b235b..c24372af 100644
--- a/src/proj_experimental.h
+++ b/src/proj_experimental.h
@@ -584,6 +584,17 @@ PJ_OBJ PROJ_DLL *proj_obj_create_conversion_hotine_oblique_mercator_two_point_na
const char* ang_unit_name, double ang_unit_conv_factor,
const char* linear_unit_name, double linear_unit_conv_factor);
+PJ_OBJ PROJ_DLL *proj_obj_create_conversion_laborde_oblique_mercator(
+ PJ_CONTEXT *ctx,
+ double latitude_projection_centre,
+ double longitude_projection_centre,
+ double azimuth_initial_line,
+ double scale,
+ double false_easting,
+ double false_northing,
+ const char* ang_unit_name, double ang_unit_conv_factor,
+ const char* linear_unit_name, double linear_unit_conv_factor);
+
PJ_OBJ PROJ_DLL *proj_obj_create_conversion_international_map_world_polyconic(
PJ_CONTEXT *ctx,
double center_long,
diff --git a/test/unit/test_c_api.cpp b/test/unit/test_c_api.cpp
index 772519ea..9c992445 100644
--- a/test/unit/test_c_api.cpp
+++ b/test/unit/test_c_api.cpp
@@ -1943,6 +1943,13 @@ TEST_F(CApi, proj_obj_create_projections) {
ASSERT_NE(projCRS, nullptr);
}
{
+ auto projCRS = proj_obj_create_conversion_laborde_oblique_mercator(
+ m_ctxt, 0, 0, 0, 0, 0, 0, "Degree", 0.0174532925199433, "Metre",
+ 1.0);
+ ObjectKeeper keeper_projCRS(projCRS);
+ ASSERT_NE(projCRS, nullptr);
+ }
+ {
auto projCRS =
proj_obj_create_conversion_international_map_world_polyconic(
m_ctxt, 0, 0, 0, 0, 0, "Degree", 0.0174532925199433, "Metre",
diff --git a/test/unit/test_operation.cpp b/test/unit/test_operation.cpp
index e5734cd1..3d1cfc42 100644
--- a/test/unit/test_operation.cpp
+++ b/test/unit/test_operation.cpp
@@ -2482,6 +2482,52 @@ TEST(operation, hotine_oblique_mercator_two_point_natural_origin_export) {
// ---------------------------------------------------------------------------
+TEST(operation, laborde_oblique_mercator_export) {
+ auto conv = Conversion::createLabordeObliqueMercator(
+ PropertyMap(), Angle(1), Angle(2), Angle(3), Scale(4), Length(5),
+ Length(6));
+ EXPECT_EQ(conv->exportToPROJString(PROJStringFormatter::create().get()),
+ "+proj=labrd +lat_0=1 +lon_0=2 +azi=3 +k=4 +x_0=5 +y_0=6");
+
+ auto formatter = WKTFormatter::create();
+ formatter->simulCurNodeHasId();
+ EXPECT_EQ(conv->exportToWKT(formatter.get()),
+ "CONVERSION[\"Laborde Oblique Mercator\",\n"
+ " METHOD[\"Laborde Oblique Mercator\",\n"
+ " ID[\"EPSG\",9813]],\n"
+ " PARAMETER[\"Latitude of projection centre\",1,\n"
+ " ANGLEUNIT[\"degree\",0.0174532925199433],\n"
+ " ID[\"EPSG\",8811]],\n"
+ " PARAMETER[\"Longitude of projection centre\",2,\n"
+ " ANGLEUNIT[\"degree\",0.0174532925199433],\n"
+ " ID[\"EPSG\",8812]],\n"
+ " PARAMETER[\"Azimuth of initial line\",3,\n"
+ " ANGLEUNIT[\"degree\",0.0174532925199433],\n"
+ " ID[\"EPSG\",8813]],\n"
+ " PARAMETER[\"Scale factor on initial line\",4,\n"
+ " SCALEUNIT[\"unity\",1],\n"
+ " ID[\"EPSG\",8815]],\n"
+ " PARAMETER[\"False easting\",5,\n"
+ " LENGTHUNIT[\"metre\",1],\n"
+ " ID[\"EPSG\",8806]],\n"
+ " PARAMETER[\"False northing\",6,\n"
+ " LENGTHUNIT[\"metre\",1],\n"
+ " ID[\"EPSG\",8807]]]");
+
+ EXPECT_EQ(
+ conv->exportToWKT(
+ WKTFormatter::create(WKTFormatter::Convention::WKT1_GDAL).get()),
+ "PROJECTION[\"Laborde_Oblique_Mercator\"],\n"
+ "PARAMETER[\"latitude_of_center\",1],\n"
+ "PARAMETER[\"longitude_of_center\",2],\n"
+ "PARAMETER[\"azimuth\",3],\n"
+ "PARAMETER[\"scale_factor\",4],\n"
+ "PARAMETER[\"false_easting\",5],\n"
+ "PARAMETER[\"false_northing\",6]");
+}
+
+// ---------------------------------------------------------------------------
+
TEST(operation, imw_polyconic_export) {
auto conv = Conversion::createInternationalMapWorldPolyconic(
PropertyMap(), Angle(1), Angle(3), Angle(4), Length(5), Length(6));