Commit c2df4f82 authored by Cédric Traizet's avatar Cédric Traizet

BUG: Use the same mapping strategy when comparing spatial reference from a...

BUG: Use the same mapping strategy when comparing spatial reference from a Datasource and a wkt string
parent 2df70eaa
Pipeline #5087 failed with stages
in 78 minutes and 19 seconds
......@@ -117,6 +117,9 @@ void PersistentImageSampleExtractorFilter<TInputImage>::GenerateOutputInformatio
#if GDAL_VERSION_NUM >= 3000000 // importFromWkt is const-correct in GDAL 3
const char* projWktCstr = projectionRefWkt.c_str();
OGRErr err = imgSRS.importFromWkt(&projWktCstr);
// Use the same mapping strategy as the one in the datasource.
imgSRS.SetAxisMappingStrategy(
this->GetOGRData()->GetLayer(this->GetLayerIndex()).GetSpatialRef()->GetAxisMappingStrategy ());
#else
const char* projWktCstr = projectionRefWkt.c_str();
char** projWktPointer = const_cast<char**>(&projWktCstr);
......
......@@ -89,6 +89,14 @@ void PersistentImageToOGRLayerFilter<TImage>::Initialize()
oSRSESRI.morphToESRI();
oSRSESRI.morphFromESRI();
#if GDAL_VERSION_NUM >= 3000000 // importFromWkt is const-correct in GDAL 3
// Use the same mapping strategy as the one in the datasource.
auto mappingStrategy =m_OGRLayer.GetSpatialRef()->GetAxisMappingStrategy ();
oSRS.SetAxisMappingStrategy(mappingStrategy);
oSRSESRI.SetAxisMappingStrategy(mappingStrategy);
#endif
if (m_OGRLayer.GetSpatialRef() && (!oSRS.IsSame(m_OGRLayer.GetSpatialRef()) && !oSRSESRI.IsSame(m_OGRLayer.GetSpatialRef())))
{
if ((oSRS.Validate() != OGRERR_NONE) && (oSRSESRI.Validate() != OGRERR_NONE))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment