Skip to content
Snippets Groups Projects
Commit 467aa02d authored by Arnaud Jaen's avatar Arnaud Jaen
Browse files

ENH: Add a REPACK sql request on Shapefile after Stitching polygons in Segmentation application.

parent 725c7981
No related branches found
No related tags found
No related merge requests found
......@@ -39,6 +39,10 @@
#include "otbOGRLayerStreamStitchingFilter.h"
#include "otbGeoInformationConversion.h"
//Utils
#include "itksys/SystemTools.hxx"
namespace otb
{
namespace Wrapper
......@@ -720,7 +724,24 @@ private:
AddProcess(fusionFilter, "Stitching polygons");
fusionFilter->GenerateData();
}
//REPACK the Layer in case of Shapefile.
//This request will remove features marked as deleted in the .dbf filename,
//and recomputed FID for each features (without holes).
//Note : the GetDriver() Method has not been encapsulated in otb::ogr::DataSource,
//so we must access the OGR pointer by using .ogr()
std::string driverName(ogrDS->ogr().GetDriver()->GetName());
if ( driverName.find("ESRI Shapefile") != std::string::npos)
{
otbAppLogINFO(<<"REPACK the Shapefile ..."<<std::endl);
//In Shapefile format, the name of the DaaSource is also the name of the Layer.
std::string shpLayerName = itksys::SystemTools::GetFilenameWithoutExtension(GetParameterString("mode.vector.out"));
std::string repack("REPACK ");
repack = repack + shpLayerName;
ogrDS->ExecuteSQL(repack, NULL, NULL);
}
}
}
}
EdisonSegmentationFilterType::Pointer m_Filter;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment