Skip to content
Snippets Groups Projects
Commit c6c8f609 authored by Emmanuel Christophe's avatar Emmanuel Christophe
Browse files

ENH: add the kml reading capability to the OGRVectorDataIO

parent 26b1f0ad
No related branches found
No related tags found
No related merge requests found
......@@ -209,22 +209,22 @@ template<class TData>
OGRDataSource::DestroyDataSource(m_DataSource);
}
// Erase the dataSource if already exist //TODO investigate the possibility of giving the option OVERWRITE=YES to the CreateDataSource method
// Erase the dataSource if already exist
//TODO investigate the possibility of giving the option OVERWRITE=YES to the CreateDataSource method
OGRDataSource * poDS = OGRSFDriverRegistrar::Open(this->m_FileName.c_str(), TRUE);
if (poDS != NULL)
if (poDS != NULL)
{
//Erase the data if possible
if (poDS->GetDriver()->TestCapability(ODrCDeleteDataSource))
{
//Erase the data if possible
if ( poDS->GetDriver()->TestCapability(ODrCDeleteDataSource) )
{
//Delete datasource
poDS->GetDriver()->DeleteDataSource(this->m_FileName.c_str());
}
//Delete datasource
poDS->GetDriver()->DeleteDataSource(this->m_FileName.c_str());
}
OGRDataSource::DestroyDataSource(poDS);
}
OGRDataSource::DestroyDataSource(poDS);
// m_DataSource = OGRSFDriverRegistrar::Open(this->m_FileName.c_str(), TRUE);
m_DataSource = ogrDriver->CreateDataSource(this->m_FileName.c_str(),papszOptions);
m_DataSource = ogrDriver->CreateDataSource(this->m_FileName.c_str(), papszOptions);
// check the created data source
......@@ -318,6 +318,8 @@ OGRVectorDataIO<TData>::GetOGRDriverName(std::string name) const
driverOGR="GML";
else if (extension=="GPX")
driverOGR="GPX";
else if (extension=="KML")
driverOGR="KML";
else
driverOGR="NOT-FOUND";
}
......
......@@ -47,8 +47,8 @@ public:
/** Register one factory of this type */
static void RegisterOneFactory(void)
{
typename OGRVectorDataIOFactory<TData>::Pointer SHPFactory = OGRVectorDataIOFactory<TData>::New();
itk::ObjectFactoryBase::RegisterFactory(SHPFactory);
typename OGRVectorDataIOFactory<TData>::Pointer OGRFactory = OGRVectorDataIOFactory<TData>::New();
itk::ObjectFactoryBase::RegisterFactory(OGRFactory);
}
protected:
......
......@@ -31,7 +31,7 @@ OGRVectorDataIOFactory<TData>::OGRVectorDataIOFactory()
{
this->RegisterOverride("otbVectorDataIOBase",
"otbOGRVectorDataIO",
"SHP Vectordata IO",
"OGR Vectordata IO",
1,
itk::CreateObjectFunction<OGRVectorDataIO<TData> >::New());
}
......@@ -49,7 +49,7 @@ template<class TData>
const char*
OGRVectorDataIOFactory<TData>::GetDescription() const
{
return "SHP VectorDataIO Factory, allows the loading of ESRI shapefile vector data into OTB";
return "OGR VectorDataIO Factory, allows the loading of ogr supported vector data into OTB";
}
} // end namespace otb
......
......@@ -32,7 +32,8 @@ namespace otb
*/
template <class TInputVectorData>
VectorDataFileWriter<TInputVectorData>
::VectorDataFileWriter() : m_FileName(""),
::VectorDataFileWriter() :
m_FileName(""),
m_VectorDataIO(0),
m_UserSpecifiedVectorDataIO(false)
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment