@@ -7307,6 +7307,7 @@ TEST(wkt_parse, wkt1_esri_normalize_unit) {
7307
7307
// ---------------------------------------------------------------------------
7308
7308
7309
7309
TEST(wkt_parse, wkt1_esri_ups_north) {
7310
+ // EPSG:32661
7310
7311
auto wkt = "PROJCS[\"UPS_North\",GEOGCS[\"GCS_WGS_1984\","
7311
7312
"DATUM[\"D_WGS_1984\","
7312
7313
"SPHEROID[\"WGS_1984\",6378137.0,298.257223563]],"
@@ -7319,24 +7320,32 @@ TEST(wkt_parse, wkt1_esri_ups_north) {
7319
7320
"PARAMETER[\"Latitude_Of_Origin\",90.0],"
7320
7321
"UNIT[\"Meter\",1.0]]";
7321
7322
7322
- auto obj = WKTParser()
7323
- .attachDatabaseContext(DatabaseContext::create())
7324
- .createFromWKT(wkt);
7323
+ auto dbContext = DatabaseContext::create();
7324
+ auto obj = WKTParser().attachDatabaseContext(dbContext).createFromWKT(wkt);
7325
7325
auto crs = nn_dynamic_pointer_cast<ProjectedCRS>(obj);
7326
7326
ASSERT_TRUE(crs != nullptr);
7327
7327
7328
- EXPECT_EQ(crs->nameStr(), "WGS 84 / UPS North (E,N )");
7328
+ EXPECT_EQ(crs->nameStr(), "WGS 84 / UPS North (N,E )");
7329
7329
EXPECT_EQ(crs->coordinateSystem()->axisList()[0]->direction(),
7330
7330
AxisDirection::SOUTH);
7331
+ // Yes, inconsistency between the name (coming from EPSG) and the fact
7332
+ // that with ESRI CRS, we always output E, N axis order
7331
7333
EXPECT_EQ(crs->coordinateSystem()->axisList()[0]->abbreviation(), "E");
7332
7334
EXPECT_EQ(crs->coordinateSystem()->axisList()[1]->direction(),
7333
7335
AxisDirection::SOUTH);
7334
7336
EXPECT_EQ(crs->coordinateSystem()->axisList()[1]->abbreviation(), "N");
7337
+
7338
+ EXPECT_EQ(
7339
+ crs->exportToWKT(
7340
+ WKTFormatter::create(WKTFormatter::Convention::WKT1_ESRI, dbContext)
7341
+ .get()),
7342
+ wkt);
7335
7343
}
7336
7344
7337
7345
// ---------------------------------------------------------------------------
7338
7346
7339
7347
TEST(wkt_parse, wkt1_esri_ups_south) {
7348
+ // EPSG:32671
7340
7349
auto wkt = "PROJCS[\"UPS_South\",GEOGCS[\"GCS_WGS_1984\","
7341
7350
"DATUM[\"D_WGS_1984\","
7342
7351
"SPHEROID[\"WGS_1984\",6378137.0,298.257223563]],"
@@ -7349,9 +7358,84 @@ TEST(wkt_parse, wkt1_esri_ups_south) {
7349
7358
"PARAMETER[\"Latitude_Of_Origin\",-90.0],"
7350
7359
"UNIT[\"Meter\",1.0]]";
7351
7360
7352
- auto obj = WKTParser()
7353
- .attachDatabaseContext(DatabaseContext::create())
7354
- .createFromWKT(wkt);
7361
+ auto dbContext = DatabaseContext::create();
7362
+ auto obj = WKTParser().attachDatabaseContext(dbContext).createFromWKT(wkt);
7363
+ auto crs = nn_dynamic_pointer_cast<ProjectedCRS>(obj);
7364
+ ASSERT_TRUE(crs != nullptr);
7365
+
7366
+ EXPECT_EQ(crs->nameStr(), "WGS 84 / UPS South (N,E)");
7367
+ EXPECT_EQ(crs->coordinateSystem()->axisList()[0]->direction(),
7368
+ AxisDirection::NORTH);
7369
+ // Yes, inconsistency between the name (coming from EPSG) and the fact
7370
+ // that with ESRI CRS, we always output E, N axis order
7371
+ EXPECT_EQ(crs->coordinateSystem()->axisList()[0]->abbreviation(), "E");
7372
+ EXPECT_EQ(crs->coordinateSystem()->axisList()[1]->direction(),
7373
+ AxisDirection::NORTH);
7374
+ EXPECT_EQ(crs->coordinateSystem()->axisList()[1]->abbreviation(), "N");
7375
+
7376
+ EXPECT_EQ(
7377
+ crs->exportToWKT(
7378
+ WKTFormatter::create(WKTFormatter::Convention::WKT1_ESRI, dbContext)
7379
+ .get()),
7380
+ wkt);
7381
+ }
7382
+
7383
+ // ---------------------------------------------------------------------------
7384
+
7385
+ TEST(wkt_parse, wkt1_esri_wgs_1984_ups_north_E_N) {
7386
+ // EPSG:5041
7387
+ auto wkt = "PROJCS[\"WGS_1984_UPS_North_(E-N)\","
7388
+ "GEOGCS[\"GCS_WGS_1984\",DATUM[\"D_WGS_1984\","
7389
+ "SPHEROID[\"WGS_1984\",6378137.0,298.257223563]],"
7390
+ "PRIMEM[\"Greenwich\",0.0],"
7391
+ "UNIT[\"Degree\",0.0174532925199433]],"
7392
+ "PROJECTION[\"Polar_Stereographic_Variant_A\"],"
7393
+ "PARAMETER[\"False_Easting\",2000000.0],"
7394
+ "PARAMETER[\"False_Northing\",2000000.0],"
7395
+ "PARAMETER[\"Central_Meridian\",0.0],"
7396
+ "PARAMETER[\"Scale_Factor\",0.994],"
7397
+ "PARAMETER[\"Latitude_Of_Origin\",90.0],"
7398
+ "UNIT[\"Meter\",1.0]]";
7399
+
7400
+ auto dbContext = DatabaseContext::create();
7401
+ auto obj = WKTParser().attachDatabaseContext(dbContext).createFromWKT(wkt);
7402
+ auto crs = nn_dynamic_pointer_cast<ProjectedCRS>(obj);
7403
+ ASSERT_TRUE(crs != nullptr);
7404
+
7405
+ EXPECT_EQ(crs->nameStr(), "WGS 84 / UPS North (E,N)");
7406
+ EXPECT_EQ(crs->coordinateSystem()->axisList()[0]->direction(),
7407
+ AxisDirection::SOUTH);
7408
+ EXPECT_EQ(crs->coordinateSystem()->axisList()[0]->abbreviation(), "E");
7409
+ EXPECT_EQ(crs->coordinateSystem()->axisList()[1]->direction(),
7410
+ AxisDirection::SOUTH);
7411
+ EXPECT_EQ(crs->coordinateSystem()->axisList()[1]->abbreviation(), "N");
7412
+
7413
+ EXPECT_EQ(
7414
+ crs->exportToWKT(
7415
+ WKTFormatter::create(WKTFormatter::Convention::WKT1_ESRI, dbContext)
7416
+ .get()),
7417
+ wkt);
7418
+ }
7419
+
7420
+ // ---------------------------------------------------------------------------
7421
+
7422
+ TEST(wkt_parse, wkt1_esri_wgs_1984_ups_south_E_N) {
7423
+ // EPSG:5042
7424
+ auto wkt = "PROJCS[\"WGS_1984_UPS_South_(E-N)\","
7425
+ "GEOGCS[\"GCS_WGS_1984\",DATUM[\"D_WGS_1984\","
7426
+ "SPHEROID[\"WGS_1984\",6378137.0,298.257223563]],"
7427
+ "PRIMEM[\"Greenwich\",0.0],"
7428
+ "UNIT[\"Degree\",0.0174532925199433]],"
7429
+ "PROJECTION[\"Polar_Stereographic_Variant_A\"],"
7430
+ "PARAMETER[\"False_Easting\",2000000.0],"
7431
+ "PARAMETER[\"False_Northing\",2000000.0],"
7432
+ "PARAMETER[\"Central_Meridian\",0.0],"
7433
+ "PARAMETER[\"Scale_Factor\",0.994],"
7434
+ "PARAMETER[\"Latitude_Of_Origin\",-90.0],"
7435
+ "UNIT[\"Meter\",1.0]]";
7436
+
7437
+ auto dbContext = DatabaseContext::create();
7438
+ auto obj = WKTParser().attachDatabaseContext(dbContext).createFromWKT(wkt);
7355
7439
auto crs = nn_dynamic_pointer_cast<ProjectedCRS>(obj);
7356
7440
ASSERT_TRUE(crs != nullptr);
7357
7441
@@ -7362,6 +7446,12 @@ TEST(wkt_parse, wkt1_esri_ups_south) {
7362
7446
EXPECT_EQ(crs->coordinateSystem()->axisList()[1]->direction(),
7363
7447
AxisDirection::NORTH);
7364
7448
EXPECT_EQ(crs->coordinateSystem()->axisList()[1]->abbreviation(), "N");
7449
+
7450
+ EXPECT_EQ(
7451
+ crs->exportToWKT(
7452
+ WKTFormatter::create(WKTFormatter::Convention::WKT1_ESRI, dbContext)
7453
+ .get()),
7454
+ wkt);
7365
7455
}
7366
7456
7367
7457
// ---------------------------------------------------------------------------
0 commit comments