Skip to content
Snippets Groups Projects
Commit 49f3fa6c authored by Victor Poughon's avatar Victor Poughon
Browse files

Merge branch 'GeoJSON_driver' into 'develop'

ENH: add GeoJSON driver and simplify driver selection

See merge request orfeotoolbox/otb!426
parents d9d35e57 a0fd0aef
Branches
Tags
No related merge requests found
......@@ -22,6 +22,7 @@
#define otbOGRVectorDataIO_h
#include <string>
#include <map>
#include <cassert>
#include "otbVectorDataIOBase.h"
......@@ -124,6 +125,19 @@ private:
GDALDataset * m_DataSource;
const std::map<std::string, std::string>
m_OGRExtensionsToDrivers = {
{ ".SHP", "ESRI Shapefile"},
{ ".TAB", "MapInfo File"},
{ ".GML", "GML"},
{ ".GPX", "GPX"},
{ ".SQLITE", "SQLite"},
{".KML", "KML"},
{ ".GMT", "OGR_GMT"},
{ ".GPKG", "GPKG"},
{ ".JSON", "GeoJSON"},
{ ".GEOJSON", "GeoJSON"}
};
};
} // end namespace otb
......
......@@ -349,16 +349,9 @@ OGRVectorDataIO::GetOGRDriverName(std::string name) const
else
{
extension = itksys::SystemTools::GetFilenameLastExtension(upperName);
if (extension == ".SHP") driverOGR = "ESRI Shapefile";
else if ((extension == ".TAB")) driverOGR = "MapInfo File";
else if (extension == ".GML") driverOGR = "GML";
else if (extension == ".GPX") driverOGR = "GPX";
else if (extension == ".SQLITE") driverOGR = "SQLite";
else if (extension==".KML") driverOGR="KML";
else if (extension == ".GMT") driverOGR = "OGR_GMT";
if(m_OGRExtensionsToDrivers.count(extension)==1) driverOGR = m_OGRExtensionsToDrivers.at(extension);
else driverOGR = "NOT-FOUND";
}
//std::cout << name << " " << driverOGR <<" "<<upperName<< " "<< upperName.substr(0, 3) << std::endl;
return driverOGR;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment