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

Merge branch '2051_CRS_equality_tests' into 'develop'

Fix spatial reference equality tests

Closes #2051 and #2055

See merge request !720
parents 57c49812 002d355d
Pipeline #5150 passed with stage
in 10 minutes and 45 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