diff --git a/include/proj/coordinateoperation.hpp b/include/proj/coordinateoperation.hpp index 1f23821a38..f0a9abefd2 100644 --- a/include/proj/coordinateoperation.hpp +++ b/include/proj/coordinateoperation.hpp @@ -945,6 +945,11 @@ class PROJ_GCC_DLL Conversion : public SingleOperation { const common::Angle ¢erLong, const common::Length &falseEasting, const common::Length &falseNorthing); + PROJ_DLL static ConversionNNPtr createTunisiaMiningGrid( + const util::PropertyMap &properties, const common::Angle ¢erLat, + const common::Angle ¢erLong, const common::Length &falseEasting, + const common::Length &falseNorthing); + PROJ_DLL static ConversionNNPtr createAlbersEqualArea(const util::PropertyMap &properties, const common::Angle &latitudeFalseOrigin, diff --git a/scripts/reference_exported_symbols.txt b/scripts/reference_exported_symbols.txt index 37d9f65d39..b82794d15d 100644 --- a/scripts/reference_exported_symbols.txt +++ b/scripts/reference_exported_symbols.txt @@ -593,6 +593,7 @@ osgeo::proj::operation::Conversion::createStereographic(osgeo::proj::util::Prope osgeo::proj::operation::Conversion::createTransverseMercator(osgeo::proj::util::PropertyMap const&, osgeo::proj::common::Angle const&, osgeo::proj::common::Angle const&, osgeo::proj::common::Scale const&, osgeo::proj::common::Length const&, osgeo::proj::common::Length const&) osgeo::proj::operation::Conversion::createTransverseMercatorSouthOriented(osgeo::proj::util::PropertyMap const&, osgeo::proj::common::Angle const&, osgeo::proj::common::Angle const&, osgeo::proj::common::Scale const&, osgeo::proj::common::Length const&, osgeo::proj::common::Length const&) osgeo::proj::operation::Conversion::createTunisiaMappingGrid(osgeo::proj::util::PropertyMap const&, osgeo::proj::common::Angle const&, osgeo::proj::common::Angle const&, osgeo::proj::common::Length const&, osgeo::proj::common::Length const&) +osgeo::proj::operation::Conversion::createTunisiaMiningGrid(osgeo::proj::util::PropertyMap const&, osgeo::proj::common::Angle const&, osgeo::proj::common::Angle const&, osgeo::proj::common::Length const&, osgeo::proj::common::Length const&) osgeo::proj::operation::Conversion::createTwoPointEquidistant(osgeo::proj::util::PropertyMap const&, osgeo::proj::common::Angle const&, osgeo::proj::common::Angle const&, osgeo::proj::common::Angle const&, osgeo::proj::common::Angle const&, osgeo::proj::common::Length const&, osgeo::proj::common::Length const&) osgeo::proj::operation::Conversion::createUTM(osgeo::proj::util::PropertyMap const&, int, bool) osgeo::proj::operation::Conversion::createVanDerGrinten(osgeo::proj::util::PropertyMap const&, osgeo::proj::common::Angle const&, osgeo::proj::common::Length const&, osgeo::proj::common::Length const&) @@ -910,6 +911,7 @@ proj_create_conversion_stereographic proj_create_conversion_transverse_mercator proj_create_conversion_transverse_mercator_south_oriented proj_create_conversion_tunisia_mapping_grid +proj_create_conversion_tunisia_mining_grid proj_create_conversion_two_point_equidistant proj_create_conversion_utm proj_create_conversion_van_der_grinten diff --git a/src/iso19111/c_api.cpp b/src/iso19111/c_api.cpp index 2f408cb2c1..ee07dc013d 100644 --- a/src/iso19111/c_api.cpp +++ b/src/iso19111/c_api.cpp @@ -5046,13 +5046,49 @@ PJ *proj_create_conversion_two_point_equidistant( // --------------------------------------------------------------------------- /** \brief Instantiate a ProjectedCRS with a conversion based on the Tunisia - * Mapping Grid projection method. + * Mining Grid projection method. * - * See osgeo::proj::operation::Conversion::createTunisiaMappingGrid(). + * See osgeo::proj::operation::Conversion::createTunisiaMiningGrid(). * * Linear parameters are expressed in (linear_unit_name, * linear_unit_conv_factor). * Angular parameters are expressed in (ang_unit_name, ang_unit_conv_factor). + * + * @deprecated. Replaced by proj_create_conversion_tunisia_mining_grid + */ +PJ *proj_create_conversion_tunisia_mining_grid( + PJ_CONTEXT *ctx, double center_lat, double center_long, + 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::createTunisiaMiningGrid( + PropertyMap(), Angle(center_lat, angUnit), + Angle(center_long, angUnit), Length(false_easting, linearUnit), + Length(false_northing, linearUnit)); + return proj_create_conversion(ctx, conv); + } catch (const std::exception &e) { + proj_log_error(ctx, __FUNCTION__, e.what()); + } + return nullptr; +} +// --------------------------------------------------------------------------- + +/** \brief Instantiate a ProjectedCRS with a conversion based on the Tunisia + * Mining Grid projection method. + * + * See osgeo::proj::operation::Conversion::createTunisiaMiningGrid(). + * + * Linear parameters are expressed in (linear_unit_name, + * linear_unit_conv_factor). + * Angular parameters are expressed in (ang_unit_name, ang_unit_conv_factor). + * + * @since 9.2 */ PJ *proj_create_conversion_tunisia_mapping_grid( PJ_CONTEXT *ctx, double center_lat, double center_long, @@ -5065,7 +5101,7 @@ PJ *proj_create_conversion_tunisia_mapping_grid( createLinearUnit(linear_unit_name, linear_unit_conv_factor)); UnitOfMeasure angUnit( createAngularUnit(ang_unit_name, ang_unit_conv_factor)); - auto conv = Conversion::createTunisiaMappingGrid( + auto conv = Conversion::createTunisiaMiningGrid( PropertyMap(), Angle(center_lat, angUnit), Angle(center_long, angUnit), Length(false_easting, linearUnit), Length(false_northing, linearUnit)); diff --git a/src/iso19111/operation/conversion.cpp b/src/iso19111/operation/conversion.cpp index 62353923d0..fa73078ce9 100644 --- a/src/iso19111/operation/conversion.cpp +++ b/src/iso19111/operation/conversion.cpp @@ -484,13 +484,43 @@ Conversion::createTwoPointEquidistant(const util::PropertyMap &properties, * @param falseEasting See \ref false_easting * @param falseNorthing See \ref false_northing * @return a new Conversion. + * @deprecated. Use createTunisiaMiningGrid() instead */ ConversionNNPtr Conversion::createTunisiaMappingGrid( const util::PropertyMap &properties, const common::Angle ¢erLat, const common::Angle ¢erLong, const common::Length &falseEasting, const common::Length &falseNorthing) { return create( - properties, EPSG_CODE_METHOD_TUNISIA_MAPPING_GRID, + properties, EPSG_CODE_METHOD_TUNISIA_MINING_GRID, + createParams(centerLat, centerLong, falseEasting, falseNorthing)); +} + +// --------------------------------------------------------------------------- + +/** \brief Instantiate a conversion based on the Tunisia Mining Grid projection + * method. + * + * This method is defined as + * + * EPSG:9816. + * + * \note There is currently no implementation of the method formulas in PROJ. + * + * @param properties See \ref general_properties of the conversion. If the name + * is not provided, it is automatically set. + * @param centerLat See \ref center_latitude + * @param centerLong See \ref center_longitude + * @param falseEasting See \ref false_easting + * @param falseNorthing See \ref false_northing + * @return a new Conversion. + * @since 9.2 + */ +ConversionNNPtr Conversion::createTunisiaMiningGrid( + const util::PropertyMap &properties, const common::Angle ¢erLat, + const common::Angle ¢erLong, const common::Length &falseEasting, + const common::Length &falseNorthing) { + return create( + properties, EPSG_CODE_METHOD_TUNISIA_MINING_GRID, createParams(centerLat, centerLong, falseEasting, falseNorthing)); } @@ -1629,9 +1659,10 @@ ConversionNNPtr Conversion::createMercatorVariantA( * * Mercator (variant B) projection method. * - * This is the B variant, also known as Mercator (2SP), defined with the latitude - * of the first standard parallel (the second standard parallel is implicitly - * the opposite value). The latitude of natural origin is fixed to zero. + * This is the B variant, also known as Mercator (2SP), defined with the + * latitude of the first standard parallel (the second standard parallel is + * implicitly the opposite value). The latitude of natural origin is fixed to + * zero. * * This method is defined as * diff --git a/src/iso19111/operation/parammappings.cpp b/src/iso19111/operation/parammappings.cpp index ecd7443a73..00c807eaee 100644 --- a/src/iso19111/operation/parammappings.cpp +++ b/src/iso19111/operation/parammappings.cpp @@ -573,6 +573,12 @@ static const MethodMapping projectionMethodMappings[] = { {PROJ_WKT2_NAME_METHOD_TWO_POINT_EQUIDISTANT, 0, "Two_Point_Equidistant", "tpeqd", nullptr, paramsTPEQD}, + {EPSG_NAME_METHOD_TUNISIA_MINING_GRID, EPSG_CODE_METHOD_TUNISIA_MINING_GRID, + "Tunisia_Mining_Grid", nullptr, + nullptr, // no proj equivalent + paramsTMG}, + + // Deprecated. Use EPSG_NAME_METHOD_TUNISIA_MINING_GRID instead {EPSG_NAME_METHOD_TUNISIA_MAPPING_GRID, EPSG_CODE_METHOD_TUNISIA_MAPPING_GRID, "Tunisia_Mapping_Grid", nullptr, nullptr, // no proj equivalent @@ -898,7 +904,7 @@ const struct MethodNameCode methodNameCodes[] = { METHOD_NAME_CODE(TRANSVERSE_MERCATOR_SOUTH_ORIENTATED), METHOD_NAME_CODE(LAMBERT_CONIC_CONFORMAL_1SP), METHOD_NAME_CODE(NZMG), - METHOD_NAME_CODE(TUNISIA_MAPPING_GRID), + METHOD_NAME_CODE(TUNISIA_MINING_GRID), METHOD_NAME_CODE(ALBERS_EQUAL_AREA), METHOD_NAME_CODE(LAMBERT_CONIC_CONFORMAL_2SP), METHOD_NAME_CODE(LAMBERT_CONIC_CONFORMAL_2SP_BELGIUM), diff --git a/src/proj_constants.h b/src/proj_constants.h index 40f188c669..2a7bbdba2f 100644 --- a/src/proj_constants.h +++ b/src/proj_constants.h @@ -50,9 +50,13 @@ #define EPSG_NAME_METHOD_NZMG "New Zealand Map Grid" #define EPSG_CODE_METHOD_NZMG 9811 +/* Deprecated because of wrong name. Use EPSG_xxx_METHOD_TUNISIA_MINING_GRID instead */ #define EPSG_NAME_METHOD_TUNISIA_MAPPING_GRID "Tunisia Mapping Grid" #define EPSG_CODE_METHOD_TUNISIA_MAPPING_GRID 9816 +#define EPSG_NAME_METHOD_TUNISIA_MINING_GRID "Tunisia Mining Grid" +#define EPSG_CODE_METHOD_TUNISIA_MINING_GRID 9816 + #define EPSG_NAME_METHOD_ALBERS_EQUAL_AREA "Albers Equal Area" #define EPSG_CODE_METHOD_ALBERS_EQUAL_AREA 9822 diff --git a/src/proj_experimental.h b/src/proj_experimental.h index 41865f1405..7e38d1e0dd 100644 --- a/src/proj_experimental.h +++ b/src/proj_experimental.h @@ -401,6 +401,15 @@ PJ PROJ_DLL *proj_create_conversion_tunisia_mapping_grid( const char* ang_unit_name, double ang_unit_conv_factor, const char* linear_unit_name, double linear_unit_conv_factor); +PJ PROJ_DLL *proj_create_conversion_tunisia_mining_grid( + PJ_CONTEXT *ctx, + double center_lat, + double center_long, + 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 PROJ_DLL *proj_create_conversion_albers_equal_area( PJ_CONTEXT *ctx, double latitude_false_origin, diff --git a/src/proj_symbol_rename.h b/src/proj_symbol_rename.h index 184f3b8a13..08004799a6 100644 --- a/src/proj_symbol_rename.h +++ b/src/proj_symbol_rename.h @@ -138,6 +138,7 @@ #define proj_create_conversion_transverse_mercator internal_proj_create_conversion_transverse_mercator #define proj_create_conversion_transverse_mercator_south_oriented internal_proj_create_conversion_transverse_mercator_south_oriented #define proj_create_conversion_tunisia_mapping_grid internal_proj_create_conversion_tunisia_mapping_grid +#define proj_create_conversion_tunisia_mining_grid internal_proj_create_conversion_tunisia_mining_grid #define proj_create_conversion_two_point_equidistant internal_proj_create_conversion_two_point_equidistant #define proj_create_conversion_utm internal_proj_create_conversion_utm #define proj_create_conversion_van_der_grinten internal_proj_create_conversion_van_der_grinten diff --git a/test/unit/test_c_api.cpp b/test/unit/test_c_api.cpp index 9b53468fa6..8d36e4c593 100644 --- a/test/unit/test_c_api.cpp +++ b/test/unit/test_c_api.cpp @@ -2648,7 +2648,7 @@ TEST_F(CApi, proj_create_projections) { ASSERT_NE(projCRS, nullptr); } { - auto projCRS = proj_create_conversion_tunisia_mapping_grid( + auto projCRS = proj_create_conversion_tunisia_mining_grid( m_ctxt, 0, 0, 0, 0, "Degree", 0.0174532925199433, "Metre", 1.0); ObjectKeeper keeper_projCRS(projCRS); ASSERT_NE(projCRS, nullptr); diff --git a/test/unit/test_operation.cpp b/test/unit/test_operation.cpp index f9fd232487..5ca34cde9b 100644 --- a/test/unit/test_operation.cpp +++ b/test/unit/test_operation.cpp @@ -1455,7 +1455,7 @@ TEST(operation, tped_export) { // --------------------------------------------------------------------------- TEST(operation, tmg_export) { - auto conv = Conversion::createTunisiaMappingGrid( + auto conv = Conversion::createTunisiaMiningGrid( PropertyMap(), Angle(1), Angle(2), Length(3), Length(4)); EXPECT_TRUE(conv->validateParameters().empty()); @@ -1463,8 +1463,8 @@ TEST(operation, tmg_export) { FormattingException); EXPECT_EQ(conv->exportToWKT(WKTFormatter::create().get()), - "CONVERSION[\"Tunisia Mapping Grid\",\n" - " METHOD[\"Tunisia Mapping Grid\",\n" + "CONVERSION[\"Tunisia Mining Grid\",\n" + " METHOD[\"Tunisia Mining Grid\",\n" " ID[\"EPSG\",9816]],\n" " PARAMETER[\"Latitude of false origin\",1,\n" " ANGLEUNIT[\"degree\",0.0174532925199433],\n" @@ -1482,7 +1482,7 @@ TEST(operation, tmg_export) { EXPECT_EQ( conv->exportToWKT( WKTFormatter::create(WKTFormatter::Convention::WKT1_GDAL).get()), - "PROJECTION[\"Tunisia_Mapping_Grid\"],\n" + "PROJECTION[\"Tunisia_Mining_Grid\"],\n" "PARAMETER[\"latitude_of_origin\",1],\n" "PARAMETER[\"central_meridian\",2],\n" "PARAMETER[\"false_easting\",3],\n"