From 0a0765f142c0ee2e8c7d9a22e091b47f060b20be Mon Sep 17 00:00:00 2001
From: Julien Michel <julien.michel@cnes.fr>
Date: Wed, 4 Nov 2015 09:08:14 +0100
Subject: [PATCH] BUG: Better handling of types in stream stitching filter in
 case gdal > 2.0 is used

---
 .../include/otbOGRLayerStreamStitchingFilter.txx | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/Modules/Segmentation/OGRProcessing/include/otbOGRLayerStreamStitchingFilter.txx b/Modules/Segmentation/OGRProcessing/include/otbOGRLayerStreamStitchingFilter.txx
index 2e3e56f9e3..b1a88bff25 100644
--- a/Modules/Segmentation/OGRProcessing/include/otbOGRLayerStreamStitchingFilter.txx
+++ b/Modules/Segmentation/OGRProcessing/include/otbOGRLayerStreamStitchingFilter.txx
@@ -318,8 +318,22 @@ OGRLayerStreamStitchingFilter<TInputImage>
                try
                  {
                  #ifdef OTB_USE_GDAL_20
-                 fusionFeature[0].SetValue(field.GetValue<GIntBig>());
+                 // In this case, the feature id can be either
+                 // OFTInteger64 or OFTInteger
+                 switch(field.GetType())
+                   {
+                   case OFTInteger64:
+                   {
+                   fusionFeature[0].SetValue(field.GetValue<GIntBig>());
+                   break;
+                   }
+                   default:
+                   {
+                   fusionFeature[0].SetValue(field.GetValue<int>());
+                   }
+                   }
                  #else
+                 // Only OFTInteger supported in this case
                  fusionFeature[0].SetValue(field.GetValue<int>());
                  #endif
                  m_OGRLayer.CreateFeature(fusionFeature);
-- 
GitLab