Commit bd849139 authored by Manuel Grizonnet's avatar Manuel Grizonnet

DOC:add simple geospatial example

parent 8a8099e9
......@@ -35,6 +35,10 @@ IF(OTB_USE_PATENTED)
ADD_SUBDIRECTORY( Patented )
ENDIF(OTB_USE_PATENTED)
IF(OTB_USE_PQXX)
ADD_SUBDIRECTORY(GeospatialAnalysis)
ENDIF(OTB_USE_PQXX)
#Recopie du fichier README.txt dans l'arborescence BINARY
IF( EXISTS ${OTB_BINARY_DIR}/Examples/README.txt )
ELSE( EXISTS ${OTB_BINARY_DIR}/Examples/README.txt )
......@@ -81,7 +85,7 @@ ELSE(OTB_BINARY_DIR)
ADD_SUBDIRECTORY(Fusion)
ADD_SUBDIRECTORY(Tutorials)
ADD_SUBDIRECTORY(Markov)
ADD_SUBDIRECTORY(OBIA)
ADD_SUBDIRECTORY(OBIA)
IF(OTB_USE_VISU_GUI)
ADD_SUBDIRECTORY(Visu)
......@@ -90,6 +94,10 @@ ELSE(OTB_BINARY_DIR)
IF(OTB_USE_PATENTED)
ADD_SUBDIRECTORY( Patented )
ENDIF(OTB_USE_PATENTED)
IF(OTB_USE_PQXX)
ADD_SUBDIRECTORY(GeospatialAnalysis)
ENDIF(OTB_USE_PQXX)
ELSE(OTB_FOUND)
MESSAGE("OTB not found. Please set OTB_DIR")
ENDIF(OTB_FOUND)
......
PROJECT(GeospatialAnalysisExamples)
INCLUDE_REGULAR_EXPRESSION("^.*$")
ADD_EXECUTABLE(PostGISCreateTable PostGISCreateTable.cxx )
TARGET_LINK_LIBRARIES(PostGISCreateTable OTBCommon OTBIO OTBGeospatialAnalysis ${OTB_IO_UTILITIES_DEPENDENT_LIBRARIES})
IF( NOT OTB_DISABLE_CXX_TESTING AND BUILD_TESTING )
SET(BASELINE ${OTB_DATA_ROOT}/Baseline/Examples/GeospatialAnalysis)
SET(INPUTDATA ${OTB_DATA_ROOT}/Examples)
#Remote sensing images (large images )
IF(OTB_DATA_USE_LARGEINPUT)
SET(INPUTLARGEDATA ${OTB_DATA_LARGEINPUT_ROOT} )
ENDIF(OTB_DATA_USE_LARGEINPUT)
SET(TEMP ${OTB_BINARY_DIR}/Testing/Temporary)
SET(EXE_TESTS ${CXX_TEST_PATH}/otbGeospatialAnalysisExamplesTests)
SET(TOL 0.0)
SET(EPS 0.001)
ADD_TEST( trTeGeospatialAnalysisPostGISCreateTableTest ${EXE_TESTS}
GeospatialAnalysisPostGISCreateTableTest
localhost
orfeotoolbox_test
orfeotoolbox_test_user
Bidfeud0
)
INCLUDE_DIRECTORIES(${OTB_SOURCE_DIR}/Testing/Code)
ADD_EXECUTABLE(otbGeospatialAnalysisExamplesTests otbGeospatialAnalysisExamplesTests.cxx)
TARGET_LINK_LIBRARIES(otbGeospatialAnalysisExamplesTests OTBCommon OTBIO OTBGeospatialAnalysis OTBTesting)
ENDIF( NOT OTB_DISABLE_CXX_TESTING AND BUILD_TESTING )
PROJECT(GeospatialAnalysisExamples)
INCLUDE_REGULAR_EXPRESSION("^.*$")
ADD_EXECUTABLE(PostGISCreateTable PostGISCreateTable.cxx )
TARGET_LINK_LIBRARIES(PostGISCreateTable OTBCommon OTBIO OTBGeospatialAnalysis ${OTB_IO_UTILITIES_DEPENDENT_LIBRARIES})
IF( NOT OTB_DISABLE_CXX_TESTING AND BUILD_TESTING )
SET(BASELINE ${OTB_DATA_ROOT}/Baseline/Examples/GeospatialAnalysis)
SET(INPUTDATA ${OTB_DATA_ROOT}/Examples)
#Remote sensing images (large images )
IF(OTB_DATA_USE_LARGEINPUT)
SET(INPUTLARGEDATA ${OTB_DATA_LARGEINPUT_ROOT} )
ENDIF(OTB_DATA_USE_LARGEINPUT)
SET(TEMP ${OTB_BINARY_DIR}/Testing/Temporary)
SET(EXE_TESTS ${CXX_TEST_PATH}/otbGeospatialAnalysisExamplesTests)
SET(TOL 0.0)
SET(EPS 0.001)
ADD_TEST( trTeGeospatialAnalysisPostGISCreateTableTest ${EXE_TESTS}
GeospatialAnalysisPostGISCreateTableTest
localhost
orfeotoolbox_test
orfeotoolbox_test_user
Bidfeud0
)
INCLUDE_DIRECTORIES(${OTB_SOURCE_DIR}/Testing/Code)
ADD_EXECUTABLE(otbGeospatialAnalysisExamplesTests otbGeospatialAnalysisExamplesTests.cxx)
TARGET_LINK_LIBRARIES(otbGeospatialAnalysisExamplesTests OTBCommon OTBDisparityMap OTBIO OTBGeospatialAnalysis OTBTesting)
ENDIF( NOT OTB_DISABLE_CXX_TESTING AND BUILD_TESTING )
/*=========================================================================
Program: ORFEO Toolbox
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
See OTBCopyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "itkExceptionObject.h"
#include "otbMacro.h"
#include "otbPostGISCreateTableTransactor.h"
#include "otbPostGISConnectionImplementation.h"
/** This test uses a transactor to create a table. The transactor
needs to have a copy constructor, so the initialization is done
correctly for the class variables which are set before the transaction
*/
int main(int argc, char * argv[])
{
typedef otb::PostGISCreateTableTransactor TransactorType;
//Instantiation
TransactorType myTransactor;
unsigned short dimension = 2;
myTransactor.SetDimension( dimension );
std::string name = "mytable";
myTransactor.SetTableName( name );
int srid = -1;
myTransactor.SetSRID( srid );
myTransactor.SetRemoveExistingTable( true );
const std::string hostName = argv[1];
const std::string dbName = argv[2];
const std::string userName = argv[3];
const std::string userPassword = argv[4];
typedef otb::PostGISConnectionImplementation GISConnectionType;
//Instantiation
GISConnectionType::Pointer connection = GISConnectionType::New();
connection->SetHost( hostName );
connection->SetDBName( dbName );
connection->SetUser( userName );
connection->SetPassword( userPassword );
connection->ConnectToDB();
connection->PerformTransaction( myTransactor );
return EXIT_SUCCESS;
}
/*=========================================================================
Program: ORFEO Toolbox
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
See OTBCopyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "itkExceptionObject.h"
#include "otbMacro.h"
#include "otbPostGISCreateTableTransactor.h"
#include "otbPostGISConnectionImplementation.h"
/** This test uses a transactor to create a table. The transactor
needs to have a copy constructor, so the initialization is done
correctly for the class variables which are set before the transaction
*/
int otbPostGISCreateTableTransactorCreate(int argc, char * argv[])
{
typedef otb::PostGISCreateTableTransactor TransactorType;
//Instantiation
TransactorType myTransactor;
unsigned short dimension = 2;
myTransactor.SetDimension( dimension );
std::string name = "mytable";
myTransactor.SetTableName( name );
int srid = -1;
myTransactor.SetSRID( srid );
myTransactor.SetRemoveExistingTable( true );
const std::string hostName = argv[1];
const std::string dbName = argv[2];
const std::string userName = argv[3];
const std::string userPassword = argv[4];
typedef otb::PostGISConnectionImplementation GISConnectionType;
//Instantiation
GISConnectionType::Pointer connection = GISConnectionType::New();
connection->SetHost( hostName );
connection->SetDBName( dbName );
connection->SetUser( userName );
connection->SetPassword( userPassword );
connection->ConnectToDB();
connection->PerformTransaction( myTransactor );
return EXIT_SUCCESS;
}
/*=========================================================================
Program: ORFEO Toolbox
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
See OTBCopyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
// this file defines the otbMultiScaleTest for the test driver
// and all it expects is that you have a function called RegisterTests
#if defined(_MSC_VER)
#pragma warning ( disable : 4786 )
#endif
#include <iostream>
#include "otbTestMain.h"
void RegisterTests()
{
REGISTER_TEST(GeospatialAnalysisPostGISCreateTableTest);
}
#undef main
#define main GeospatialAnalysisPostGISCreateTableTest
#include "PostGISCreateTable.cxx"
/*=========================================================================
Program: ORFEO Toolbox
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
See OTBCopyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
// this file defines the otbMultiScaleTest for the test driver
// and all it expects is that you have a function called RegisterTests
#if defined(_MSC_VER)
#pragma warning ( disable : 4786 )
#endif
#include <iostream>
#include "otbTestMain.h"
void RegisterTests()
{
REGISTER_TEST(GeospatialAnalysisPostGISCreateTableTest);
}
#undef main
#define main OBIAImageToLabelToImageTest
#include "PostGISCreateTable.cxx"
......@@ -42,7 +42,6 @@
#include <fstream>
#include <iostream>
#include "otbImage.h"
#include "otbLabelMapToVectorDataFilter.h"
#include "otbAttributesMapLabelObject.h"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment