Description: Fix FTBFS with GDAL 3.12.0.
Author: Bas Couwenberg <sebastic@debian.org>
Forwarded: https://github.com/ec-jrc/jeolib-jiplib/pull/7

--- a/src/imageclasses/VectorOgr.cc
+++ b/src/imageclasses/VectorOgr.cc
@@ -475,7 +475,7 @@ void VectorOgr::close(void)
 }
 
 ///Create a layer
-OGRErr VectorOgr::pushLayer(const std::string& layername, OGRSpatialReference* theSRS, const OGRwkbGeometryType& geometryType, char** papszOptions){
+OGRErr VectorOgr::pushLayer(const std::string& layername, const OGRSpatialReference* theSRS, const OGRwkbGeometryType& geometryType, char** papszOptions){
   if( !m_gds->TestCapability( ODsCCreateLayer ) ){
     // std::ostringstream errorStream;
     // errorStream << "Error: Test capability to create layer " << layername << " failed (1)" << std::endl;
@@ -2016,7 +2016,7 @@ void VectorOgr::merge(VectorOgr &ogrRead
       if(verbose_opt[0])
         std::cout << "layer: " << layerstream.str() << std::endl;
 
-      OGRSpatialReference *thatSpatialRef=ogrReader.getLayer(ilayer)->GetSpatialRef();
+      OGRSpatialReference *thatSpatialRef=ogrReader.getLayer(ilayer)->GetSpatialRef()->Clone();
 #if GDAL_VERSION_MAJOR > 2
       thatSpatialRef->SetAxisMappingStrategy(OSRAxisMappingStrategy::OAMS_TRADITIONAL_GIS_ORDER);
 #endif
--- a/src/imageclasses/VectorOgr.h
+++ b/src/imageclasses/VectorOgr.h
@@ -207,7 +207,7 @@ class VectorOgr : public std::enable_sha
   ///Get the filename of this dataset
   std::string getFileName() const {return m_filename;};
   ///Create a layer
-  OGRErr pushLayer(const std::string& layername, OGRSpatialReference* theSRS, const OGRwkbGeometryType& geometryType=wkbUnknown, char** papszOptions=NULL);
+  OGRErr pushLayer(const std::string& layername, const OGRSpatialReference* theSRS, const OGRwkbGeometryType& geometryType=wkbUnknown, char** papszOptions=NULL);
   ///Create a layer
   OGRErr pushLayer(const std::string& layername, const std::string& theProjection=std::string(), const OGRwkbGeometryType& geometryType=wkbUnknown, char** papszOptions=NULL);
   ///Create a layer
