Skip to content

Commit

Permalink
Merge pull request #4229 from rouault/fine_tune_local_ortho
Browse files Browse the repository at this point in the history
Fix parameter mappings of Local Orthographic, and re-import ESRI database with the mapping for this method
  • Loading branch information
rouault authored Aug 16, 2024
2 parents c83e18e + f9f8b7f commit 8a94b99
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 49 deletions.
6 changes: 4 additions & 2 deletions data/sql/esri.sql
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
--- This file has been generated by scripts/build_db_from_esri.py. DO NOT EDIT !

INSERT INTO "metadata" VALUES('ESRI.VERSION', 'ArcGIS Pro 3.3');
INSERT INTO "metadata" VALUES('ESRI.DATE', '2024-05-07');
INSERT INTO "metadata" VALUES('ESRI.DATE', '2024-08-16');
INSERT INTO alias_name VALUES('unit_of_measure','EPSG','1025','Millimeter','ESRI');
INSERT INTO alias_name VALUES('unit_of_measure','EPSG','1033','Centimeter','ESRI');
INSERT INTO alias_name VALUES('unit_of_measure','EPSG','9001','Meter','ESRI');
Expand Down Expand Up @@ -10756,7 +10756,9 @@ INSERT INTO "usage" VALUES('ESRI', 'CONV_102459_USAGE','conversion','ESRI','1024
INSERT INTO "projected_crs" VALUES('ESRI','102459','NAD_1983_Idaho-Ada_County',NULL,'EPSG','4497','EPSG','4269','ESRI','102459',NULL,0);
INSERT INTO "usage" VALUES('ESRI', 'PCRS_102459_USAGE','projected_crs','ESRI','102459','ESRI','57','EPSG','1024');
INSERT INTO "extent" VALUES('ESRI','58','HJAIA - Hartsfield-Jackson Atlanta Intl Airport','HJAIA - Hartsfield-Jackson Atlanta Intl Airport',33.590879,33.68427937,-84.502368,-84.351204,0);
INSERT INTO "projected_crs" VALUES('ESRI','102460','HJAIA_AirportGrid_2Mar10',NULL,NULL,NULL,'EPSG','4269',NULL,NULL,'PROJCS["HJAIA_AirportGrid_2Mar10",GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Local"],PARAMETER["False_Easting",11233.741],PARAMETER["False_Northing",3076.34],PARAMETER["Scale_Factor",1.000047],PARAMETER["Azimuth",-0.01935],PARAMETER["Longitude_Of_Center",-84.4306922136],PARAMETER["Latitude_Of_Center",33.6340844042],UNIT["Foot_US",0.3048006096012192]]',0);
INSERT INTO "conversion" VALUES('ESRI','102460','unnamed',NULL,'EPSG','1130','Local Orthographic','EPSG','8811','Latitude of projection centre',33.6340844042,'EPSG','9102','EPSG','8812','Longitude of projection centre',-84.4306922136,'EPSG','9102','EPSG','8813','Azimuth at projection centre',-0.01935,'EPSG','9102','EPSG','8815','Scale factor at projection centre',1.000047,'EPSG','9201','EPSG','8816','Easting at projection centre',11233.741,'EPSG','9003','EPSG','8817','Northing at projection centre',3076.34,'EPSG','9003',NULL,NULL,NULL,NULL,NULL,NULL,0);
INSERT INTO "usage" VALUES('ESRI', 'CONV_102460_USAGE','conversion','ESRI','102460','ESRI','58','EPSG','1024');
INSERT INTO "projected_crs" VALUES('ESRI','102460','HJAIA_AirportGrid_2Mar10',NULL,'EPSG','4497','EPSG','4269','ESRI','102460',NULL,0);
INSERT INTO "usage" VALUES('ESRI', 'PCRS_102460_USAGE','projected_crs','ESRI','102460','ESRI','58','EPSG','1024');
INSERT INTO "conversion" VALUES('ESRI','102461','unnamed',NULL,'EPSG','9807','Transverse Mercator','EPSG','8801','Latitude of natural origin',18.83333333333333,'EPSG','9102','EPSG','8802','Longitude of natural origin',-155.5,'EPSG','9102','EPSG','8805','Scale factor at natural origin',0.9999666666666667,'EPSG','9201','EPSG','8806','False easting',1640416.666666667,'EPSG','9003','EPSG','8807','False northing',0.0,'EPSG','9003',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0);
INSERT INTO "usage" VALUES('ESRI', 'CONV_102461_USAGE','conversion','ESRI','102461','EPSG','1546','EPSG','1024');
Expand Down
14 changes: 14 additions & 0 deletions scripts/build_db_from_esri.py
Original file line number Diff line number Diff line change
Expand Up @@ -1064,6 +1064,8 @@ def get_cs_from_false_easting_and_northing(params: Dict[str, ParameterValue]) ->
8813: 'Azimuth at projection centre',
8814: 'Angle from Rectified to Skew Grid',
8815: 'Scale factor at projection centre',
8816: 'Easting at projection centre',
8817: 'Northing at projection centre',
8821: 'Latitude of false origin',
8822: 'Longitude of false origin',
8823: 'Latitude of 1st standard parallel',
Expand Down Expand Up @@ -1175,6 +1177,18 @@ class ConversionMapping:
8807: 'False_Northing',
}
),
'Local': ConversionMapping(
epsg_code='1130',
epsg_name='Local Orthographic',
param_mapping={
8811: 'Latitude_Of_Center',
8812: 'Longitude_Of_Center',
8813: 'Azimuth',
8815: 'Scale_Factor',
8816: 'False_Easting',
8817: 'False_Northing',
}
),

}

Expand Down
8 changes: 4 additions & 4 deletions scripts/build_esri_projection_mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -458,12 +458,12 @@
- Local:
WKT2_name: EPSG_NAME_METHOD_LOCAL_ORTHOGRAPHIC
Params:
- False_Easting: EPSG_NAME_PARAMETER_FALSE_EASTING
- False_Northing: EPSG_NAME_PARAMETER_FALSE_NORTHING
- False_Easting: EPSG_NAME_PARAMETER_EASTING_PROJECTION_CENTRE
- False_Northing: EPSG_NAME_PARAMETER_NORTHING_PROJECTION_CENTRE
- Scale_Factor: EPSG_NAME_PARAMETER_SCALE_FACTOR_PROJECTION_CENTRE
- Azimuth: EPSG_NAME_PARAMETER_AZIMUTH_PROJECTION_CENTRE
- Longitude_Of_Center: EPSG_NAME_PARAMETER_LONGITUDE_OF_NATURAL_ORIGIN
- Latitude_Of_Center: EPSG_NAME_PARAMETER_LATITUDE_OF_NATURAL_ORIGIN
- Longitude_Of_Center: EPSG_NAME_PARAMETER_LONGITUDE_PROJECTION_CENTRE
- Latitude_Of_Center: EPSG_NAME_PARAMETER_LATITUDE_PROJECTION_CENTRE
- Winkel_Tripel:
WKT2_name: "Winkel Tripel"
Expand Down
22 changes: 11 additions & 11 deletions src/iso19111/operation/esriparammappings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -611,18 +611,18 @@ static const ESRIParamMapping paramsESRI_Orthographic[] = {
{nullptr, nullptr, 0, "0.0", false}};

static const ESRIParamMapping paramsESRI_Local[] = {
{"False_Easting", EPSG_NAME_PARAMETER_FALSE_EASTING,
EPSG_CODE_PARAMETER_FALSE_EASTING, "0.0", false},
{"False_Northing", EPSG_NAME_PARAMETER_FALSE_NORTHING,
EPSG_CODE_PARAMETER_FALSE_NORTHING, "0.0", false},
{"False_Easting", EPSG_NAME_PARAMETER_EASTING_PROJECTION_CENTRE,
EPSG_CODE_PARAMETER_EASTING_PROJECTION_CENTRE, "0.0", false},
{"False_Northing", EPSG_NAME_PARAMETER_NORTHING_PROJECTION_CENTRE,
EPSG_CODE_PARAMETER_NORTHING_PROJECTION_CENTRE, "0.0", false},
{"Scale_Factor", EPSG_NAME_PARAMETER_SCALE_FACTOR_PROJECTION_CENTRE,
EPSG_CODE_PARAMETER_SCALE_FACTOR_PROJECTION_CENTRE, "1.0", false},
EPSG_CODE_PARAMETER_SCALE_FACTOR_PROJECTION_CENTRE, "0.0", false},
{"Azimuth", EPSG_NAME_PARAMETER_AZIMUTH_PROJECTION_CENTRE,
EPSG_CODE_PARAMETER_AZIMUTH_PROJECTION_CENTRE, "0.0", false},
{"Longitude_Of_Center", EPSG_NAME_PARAMETER_LONGITUDE_OF_NATURAL_ORIGIN,
EPSG_CODE_PARAMETER_LONGITUDE_OF_NATURAL_ORIGIN, "0.0", false},
{"Latitude_Of_Center", EPSG_NAME_PARAMETER_LATITUDE_OF_NATURAL_ORIGIN,
EPSG_CODE_PARAMETER_LATITUDE_OF_NATURAL_ORIGIN, "0.0", false},
{"Longitude_Of_Center", EPSG_NAME_PARAMETER_LONGITUDE_PROJECTION_CENTRE,
EPSG_CODE_PARAMETER_LONGITUDE_PROJECTION_CENTRE, "0.0", false},
{"Latitude_Of_Center", EPSG_NAME_PARAMETER_LATITUDE_PROJECTION_CENTRE,
EPSG_CODE_PARAMETER_LATITUDE_PROJECTION_CENTRE, "0.0", false},
{nullptr, nullptr, 0, "0.0", false}};

static const ESRIParamMapping paramsESRI_Winkel_Tripel[] = {
Expand Down Expand Up @@ -1052,8 +1052,8 @@ static const ESRIMethodMapping esriMappings[] = {
EPSG_NAME_METHOD_POLAR_STEREOGRAPHIC_VARIANT_A,
EPSG_CODE_METHOD_POLAR_STEREOGRAPHIC_VARIANT_A,
paramsESRI_Polar_Stereographic_Variant_A},
{"Equidistant_Conic", PROJ_WKT2_NAME_METHOD_EQUIDISTANT_CONIC, 0,
paramsESRI_Equidistant_Conic},
{"Equidistant_Conic", EPSG_NAME_METHOD_EQUIDISTANT_CONIC,
EPSG_CODE_METHOD_EQUIDISTANT_CONIC, paramsESRI_Equidistant_Conic},
{"Cassini", EPSG_NAME_METHOD_CASSINI_SOLDNER,
EPSG_CODE_METHOD_CASSINI_SOLDNER, paramsESRI_Cassini},
{"Van_der_Grinten_I", PROJ_WKT2_NAME_METHOD_VAN_DER_GRINTEN, 0,
Expand Down
36 changes: 18 additions & 18 deletions src/iso19111/operation/parammappings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -367,24 +367,24 @@ static const ParamMapping *const paramsHomTwoPoint[] = {
&paramFalseNorthingProjectionCentre,
nullptr};

static const ParamMapping *const paramsNatOriginAzimuthScale[] = {
&paramLatitudeNatOrigin,
&paramLongitudeNatOrigin,
&paramAzimuth,
&paramScaleFactorProjectionCentre,
&paramFalseEasting,
&paramFalseNorthing,
nullptr};

static const ParamMapping *const paramsIMWP[] = {
&paramLongitudeNatOrigin, &paramLatFirstPoint, &paramLatSecondPoint,
&paramFalseEasting, &paramFalseNorthing, nullptr};

static const ParamMapping paramLongCentreLongCenter = {
EPSG_NAME_PARAMETER_LONGITUDE_OF_ORIGIN,
EPSG_CODE_PARAMETER_LONGITUDE_OF_ORIGIN, WKT1_LONGITUDE_OF_CENTER,
static const ParamMapping paramLongCentre = {
EPSG_NAME_PARAMETER_LONGITUDE_PROJECTION_CENTRE,
EPSG_CODE_PARAMETER_LONGITUDE_PROJECTION_CENTRE, WKT1_LONGITUDE_OF_CENTER,
common::UnitOfMeasure::Type::ANGULAR, lon_0};

static const ParamMapping *const paramsLocalOrthographic[] = {
&paramLatCentreLatCenter,
&paramLongCentre,
&paramAzimuth,
&paramScaleFactorProjectionCentre,
&paramFalseEastingProjectionCentre,
&paramFalseNorthingProjectionCentre,
nullptr};

static const ParamMapping paramColatitudeConeAxis = {
EPSG_NAME_PARAMETER_COLATITUDE_CONE_AXIS,
EPSG_CODE_PARAMETER_COLATITUDE_CONE_AXIS, WKT1_AZIMUTH,
Expand All @@ -403,6 +403,11 @@ static const ParamMapping paramScaleFactorPseudoStdParallel = {
WKT1_SCALE_FACTOR, common::UnitOfMeasure::Type::SCALE,
k}; /* ignored by PROJ currently */

static const ParamMapping paramLongCentreLongCenter = {
EPSG_NAME_PARAMETER_LONGITUDE_OF_ORIGIN,
EPSG_CODE_PARAMETER_LONGITUDE_OF_ORIGIN, WKT1_LONGITUDE_OF_CENTER,
common::UnitOfMeasure::Type::ANGULAR, lon_0};

static const ParamMapping *const krovakParameters[] = {
&paramLatCentreLatCenter,
&paramLongCentreLongCenter,
Expand Down Expand Up @@ -500,11 +505,6 @@ static const ParamMapping *const paramsLoxim[] = {
&paramLatLoxim, &paramLongitudeNatOrigin, &paramFalseEasting,
&paramFalseNorthing, nullptr};

static const ParamMapping paramLongCentre = {
EPSG_NAME_PARAMETER_LONGITUDE_PROJECTION_CENTRE,
EPSG_CODE_PARAMETER_LONGITUDE_PROJECTION_CENTRE, WKT1_LONGITUDE_OF_CENTER,
common::UnitOfMeasure::Type::ANGULAR, lon_0};

static const ParamMapping paramLabordeObliqueMercatorAzimuth = {
EPSG_NAME_PARAMETER_AZIMUTH_PROJECTION_CENTRE,
EPSG_CODE_PARAMETER_AZIMUTH_PROJECTION_CENTRE, WKT1_AZIMUTH,
Expand Down Expand Up @@ -832,7 +832,7 @@ static const MethodMapping projectionMethodMappings[] = {
"Orthographic", "ortho", nullptr, paramsNatOrigin},

{EPSG_NAME_METHOD_LOCAL_ORTHOGRAPHIC, EPSG_CODE_METHOD_LOCAL_ORTHOGRAPHIC,
"Local Orthographic", "ortho", nullptr, paramsNatOriginAzimuthScale},
"Local Orthographic", "ortho", nullptr, paramsLocalOrthographic},

{PROJ_WKT2_NAME_ORTHOGRAPHIC_SPHERICAL, 0, "Orthographic", "ortho", "f=0",
paramsNatOrigin},
Expand Down
8 changes: 4 additions & 4 deletions test/unit/test_io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7415,12 +7415,12 @@ static const struct {
{"Latitude_Of_Center", 4}},
"Local Orthographic",
{
{"Latitude of natural origin", 4},
{"Longitude of natural origin", 3},
{"Latitude of projection centre", 4},
{"Longitude of projection centre", 3},
{"Azimuth at projection centre", 15},
{"Scale factor at projection centre", 1.25},
{"False easting", 1},
{"False northing", 2},
{"Easting at projection centre", 1},
{"Northing at projection centre", 2},
}},

{"Winkel_Tripel",
Expand Down
20 changes: 10 additions & 10 deletions test/unit/test_operation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3620,31 +3620,31 @@ TEST(operation, local_orthographic_export) {
"CONVERSION[\"Local Orthographic\",\n"
" METHOD[\"Local Orthographic\",\n"
" ID[\"EPSG\",1130]],\n"
" PARAMETER[\"Latitude of natural origin\",1,\n"
" PARAMETER[\"Latitude of projection centre\",1,\n"
" ANGLEUNIT[\"degree\",0.0174532925199433],\n"
" ID[\"EPSG\",8801]],\n"
" PARAMETER[\"Longitude of natural origin\",2,\n"
" ID[\"EPSG\",8811]],\n"
" PARAMETER[\"Longitude of projection centre\",2,\n"
" ANGLEUNIT[\"degree\",0.0174532925199433],\n"
" ID[\"EPSG\",8802]],\n"
" ID[\"EPSG\",8812]],\n"
" PARAMETER[\"Azimuth at projection centre\",3,\n"
" ANGLEUNIT[\"degree\",0.0174532925199433],\n"
" ID[\"EPSG\",8813]],\n"
" PARAMETER[\"Scale factor at projection centre\",1.25,\n"
" SCALEUNIT[\"unity\",1],\n"
" ID[\"EPSG\",8815]],\n"
" PARAMETER[\"False easting\",4,\n"
" PARAMETER[\"Easting at projection centre\",4,\n"
" LENGTHUNIT[\"metre\",1],\n"
" ID[\"EPSG\",8806]],\n"
" PARAMETER[\"False northing\",5,\n"
" ID[\"EPSG\",8816]],\n"
" PARAMETER[\"Northing at projection centre\",5,\n"
" LENGTHUNIT[\"metre\",1],\n"
" ID[\"EPSG\",8807]]]");
" ID[\"EPSG\",8817]]]");

EXPECT_EQ(
conv->exportToWKT(
WKTFormatter::create(WKTFormatter::Convention::WKT1_GDAL).get()),
"PROJECTION[\"Local Orthographic\"],\n"
"PARAMETER[\"latitude_of_origin\",1],\n"
"PARAMETER[\"central_meridian\",2],\n"
"PARAMETER[\"latitude_of_center\",1],\n"
"PARAMETER[\"longitude_of_center\",2],\n"
"PARAMETER[\"azimuth\",3],\n"
"PARAMETER[\"scale_factor\",1.25],\n"
"PARAMETER[\"false_easting\",4],\n"
Expand Down

0 comments on commit 8a94b99

Please sign in to comment.