aboutsummaryrefslogtreecommitdiff
path: root/src/io.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/io.cpp')
-rw-r--r--src/io.cpp28
1 files changed, 21 insertions, 7 deletions
diff --git a/src/io.cpp b/src/io.cpp
index 29417c73..691d96e3 100644
--- a/src/io.cpp
+++ b/src/io.cpp
@@ -3299,6 +3299,18 @@ ConversionNNPtr WKTParser::Private::buildProjectionStandard(
// ---------------------------------------------------------------------------
+static ProjectedCRSNNPtr createPseudoMercator(PropertyMap &props) {
+ auto conversion = Conversion::createPopularVisualisationPseudoMercator(
+ PropertyMap().set(IdentifiedObject::NAME_KEY, "unnamed"), Angle(0),
+ Angle(0), Length(0), Length(0));
+ props.set(IdentifiedObject::NAME_KEY, "WGS 84 / Pseudo-Mercator");
+ return ProjectedCRS::create(
+ props, GeographicCRS::EPSG_4326, conversion,
+ CartesianCS::createEastingNorthing(UnitOfMeasure::METRE));
+}
+
+// ---------------------------------------------------------------------------
+
ProjectedCRSNNPtr
WKTParser::Private::buildProjectedCRS(const WKTNodeNNPtr &node) {
@@ -3312,13 +3324,15 @@ WKTParser::Private::buildProjectedCRS(const WKTNodeNNPtr &node) {
auto props = buildProperties(node);
if (isNull(conversionNode) && hasWebMercPROJ4String(node, projectionNode)) {
- auto conversion = Conversion::createPopularVisualisationPseudoMercator(
- PropertyMap().set(IdentifiedObject::NAME_KEY, "unnamed"), Angle(0),
- Angle(0), Length(0), Length(0));
- props.set(IdentifiedObject::NAME_KEY, "WGS 84 / Pseudo-Mercator");
- return ProjectedCRS::create(
- props, GeographicCRS::EPSG_4326, conversion,
- CartesianCS::createEastingNorthing(UnitOfMeasure::METRE));
+ return createPseudoMercator(props);
+ }
+
+ const std::string projectedCRSName = stripQuotes(nodeP->children()[0]);
+ // Particular case for corrupted ESRI WKT generated by older GDAL versions
+ // https://trac.osgeo.org/gdal/changeset/30732
+ if (metadata::Identifier::isEquivalentName(projectedCRSName.c_str(),
+ "WGS_84_Pseudo_Mercator")) {
+ return createPseudoMercator(props);
}
auto &baseGeodCRSNode =