diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2018-12-06 16:32:02 +0100 |
|---|---|---|
| committer | Even Rouault <even.rouault@spatialys.com> | 2018-12-06 16:32:02 +0100 |
| commit | 6afbfc737384a4f58f2d5f8bc3bde69dacf9b355 (patch) | |
| tree | 4245f2de04da50e657d0c856903f68c148421a77 | |
| parent | a9ef3a229c6fef5ef8a05ba521a0237f2ffa6aa6 (diff) | |
| download | PROJ-6afbfc737384a4f58f2d5f8bc3bde69dacf9b355.tar.gz PROJ-6afbfc737384a4f58f2d5f8bc3bde69dacf9b355.zip | |
Fine tune axis denomination when exporting to WKT1_GDAL
| -rw-r--r-- | src/coordinatesystem.cpp | 8 | ||||
| -rw-r--r-- | test/unit/test_crs.cpp | 22 |
2 files changed, 29 insertions, 1 deletions
diff --git a/src/coordinatesystem.cpp b/src/coordinatesystem.cpp index f1220878..2305e6c4 100644 --- a/src/coordinatesystem.cpp +++ b/src/coordinatesystem.cpp @@ -325,7 +325,13 @@ void CoordinateSystemAxis::_exportToWKT(io::WKTFormatter *formatter, int order, axisDesignation = tolower(axisName.substr(0, 1)) + axisName.substr(1); } else { - axisDesignation = axisName; + if (axisName == "Geodetic latitude") { + axisDesignation = "Latitude"; + } else if (axisName == "Geodetic longitude") { + axisDesignation = "Longitude"; + } else { + axisDesignation = axisName; + } } } diff --git a/test/unit/test_crs.cpp b/test/unit/test_crs.cpp index 9c11ac4c..207aa7fb 100644 --- a/test/unit/test_crs.cpp +++ b/test/unit/test_crs.cpp @@ -339,6 +339,28 @@ TEST(crs, EPSG_4326_as_WKT1_GDAL_with_axis) { // --------------------------------------------------------------------------- +TEST(crs, EPSG_4326_from_db_as_WKT1_GDAL_with_axis) { + auto factory = AuthorityFactory::create(DatabaseContext::create(), "EPSG"); + auto crs = factory->createCoordinateReferenceSystem("4326"); + auto wkt = crs->exportToWKT( + &(WKTFormatter::create(WKTFormatter::Convention::WKT1_GDAL) + ->setOutputAxis(WKTFormatter::OutputAxisRule::YES))); + EXPECT_EQ(wkt, "GEOGCS[\"WGS 84\",\n" + " DATUM[\"WGS_1984\",\n" + " SPHEROID[\"WGS 84\",6378137,298.257223563,\n" + " AUTHORITY[\"EPSG\",\"7030\"]],\n" + " AUTHORITY[\"EPSG\",\"6326\"]],\n" + " PRIMEM[\"Greenwich\",0,\n" + " AUTHORITY[\"EPSG\",\"8901\"]],\n" + " UNIT[\"degree\",0.0174532925199433,\n" + " AUTHORITY[\"EPSG\",\"9122\"]],\n" + " AXIS[\"Latitude\",NORTH],\n" + " AXIS[\"Longitude\",EAST],\n" + " AUTHORITY[\"EPSG\",\"4326\"]]"); +} + +// --------------------------------------------------------------------------- + TEST(crs, EPSG_4326_as_WKT1_ESRI_with_database) { auto crs = GeographicCRS::EPSG_4326; WKTFormatterNNPtr f(WKTFormatter::create( |
