diff --git a/Code/Common/otbGISTable.h b/Code/Common/otbGISTable.h index b7fc1dbe4080c48f9920ed435ab290355645e841..3595376922f2cb75c8795ec2b5f23414fcbb1727 100644 --- a/Code/Common/otbGISTable.h +++ b/Code/Common/otbGISTable.h @@ -88,7 +88,7 @@ public: itkSetObjectMacro(Connection, ConnectionType); /** Clear the vector data not implemented yet*/ - virtual bool Clear(){}; + virtual bool Clear(){return true;}; /** Get attributes of the Table*/ //TODO implement @@ -108,7 +108,7 @@ public: virtual std::string GetProjectionRef() const; /** Get string connection usable by OGR library*/ - virtual std::string GetOGRStrConnection() const {}; + virtual std::string GetOGRStrConnection() const {return 0;}; /** Add an alpha numeric column to the table */ virtual const std::string AddVarCharColumn(unsigned int size) {}; diff --git a/Code/Common/otbVectorDataToGISTableFilter.txx b/Code/Common/otbVectorDataToGISTableFilter.txx index 5cafe5fec59e8bf57bea0027459174e3a555f093..24a9f7efb065322e5d1b8425e2c84694ba58fc2a 100644 --- a/Code/Common/otbVectorDataToGISTableFilter.txx +++ b/Code/Common/otbVectorDataToGISTableFilter.txx @@ -127,7 +127,8 @@ VectorDataToGISTableFilter< TVectorData, TGISTable > /**Name of the table is settedd automaticcaly to "vector_data_to_gis"*/ // output->SetTableName ("vector_data_to_gis"); - output->SetTableName (this->GetGISTableName()); + //output->SetTableName (this->GetGISTableName()); + output->SetTableName (""); /**Create the PostgreSQL table*/ //output->CreateTable(m_DropExistingGISTable); @@ -152,7 +153,16 @@ VectorDataToGISTableFilter< TVectorData, TGISTable > //Write VectorData to the GIS Table using OGR translation gisWriter->SetFileName(outputOGRConnStr); otbGenericMsgDebugMacro(<<"Write vector data to GIS table " << outputOGRConnStr); - gisWriter->Write(input); + + + //Write with overwrite =true option + std::string overStr("OVERWRITE=yes"); + char *overOptions[]={ const_cast <char *> (overStr.c_str()) }; +// std::cout << *overOptions << std::endl; + gisWriter->Write(input, overOptions); + + output->SetTableName (inputRoot->Get()->GetNodeId()); + std::cout << "tablename " << output->GetTableName() << std::endl; } else {