Skip to content

Commit

Permalink
Merge pull request #3873 from rouault/fix_3871
Browse files Browse the repository at this point in the history
ESRI WKT import: normalize GCS_unknown to unknown and D_unknown to unknown (fixes #3871)
  • Loading branch information
rouault authored Sep 2, 2023
2 parents 4a14240 + 8d52b30 commit 8a2cf2d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/iso19111/io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1732,6 +1732,8 @@ PropertyMap &WKTParser::Private::buildProperties(const WKTNodeNNPtr &node,
esriStyle_ = true;
if (name == "GCS_WGS_1984") {
name = "WGS 84";
} else if (name == "GCS_unknown") {
name = "unknown";
} else {
tableNameForAlias = "geodetic_crs";
}
Expand Down Expand Up @@ -2376,6 +2378,8 @@ GeodeticReferenceFrameNNPtr WKTParser::Private::buildGeodeticReferenceFrame(
name = "European Terrestrial Reference System 1989";
authNameFromAlias = Identifier::EPSG;
codeFromAlias = "6258";
} else if (name == "D_unknown") {
name = "unknown";
} else {
tableNameForAlias = "geodetic_datum";
}
Expand Down
13 changes: 13 additions & 0 deletions test/unit/test_io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -833,6 +833,19 @@ TEST(wkt_parse, wkt1_non_conformant_inf_inverse_flattening) {

// ---------------------------------------------------------------------------

TEST(wkt_parse, wkt1_esri_GCS_unknown_D_unknown) {
auto obj = WKTParser().setStrict(false).createFromWKT(
"GEOGCS[\"GCS_unknown\",DATUM[\"D_unknown\","
"SPHEROID[\"unknown\",6370997,0]],"
"PRIMEM[\"Greenwich\",0],UNIT[\"Degree\",0.017453292519943295]]");
auto crs = nn_dynamic_pointer_cast<GeographicCRS>(obj);
ASSERT_TRUE(crs != nullptr);
EXPECT_EQ(crs->nameStr(), "unknown");
EXPECT_EQ(crs->datum()->nameStr(), "unknown");
}

// ---------------------------------------------------------------------------

TEST(wkt_parse, wkt2_GEODCRS_EPSG_4326) {
auto obj = WKTParser().createFromWKT("GEODCRS" + contentWKT2_EPSG_4326);
auto crs = nn_dynamic_pointer_cast<GeographicCRS>(obj);
Expand Down

0 comments on commit 8a2cf2d

Please sign in to comment.