From 413f19e8d9fbe0c165a80d0f85f477e82f6e7ccf Mon Sep 17 00:00:00 2001 From: Emmanuel Christophe Date: Wed, 29 Apr 2009 11:03:11 +0800 Subject: [PATCH] Start doing it with OTB classes --- mapnikOTBClasses.cxx | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/mapnikOTBClasses.cxx b/mapnikOTBClasses.cxx index b9add763aa..f47eabc8fd 100644 --- a/mapnikOTBClasses.cxx +++ b/mapnikOTBClasses.cxx @@ -1,8 +1,43 @@ +#include "otbVectorDataFileReader.h" +#include "otbVectorData.h" +#include "otbVectorDataProjectionFilter.h" +#include +#include +#include "itkRGBAPixel.h" +#include "otbImage.h" +#include "otbVectorDataToImageFilter.h" int main(int argc, char * argv[]) { + //Read the vector data + typedef otb::VectorDataFileReader VectorDataFileReaderType; + VectorDataFileReaderType::Pointer reader = VectorDataFileReaderType::New(); + + reader->SetFileName(argv[1]); + + //Reproject the vector data in the proper projection + typedef otb::VectorDataProjectionFilter ProjectionFilterType; + ProjectionFilterType::Pointer projection = ProjectionFilterType::New(); + projection->SetInput(reader->GetOutput()); +// projection->Update(); + + //Convert the vector data into an image + typedef itk::RGBAPixel< unsigned char > PixelType; + typedef otb::Image ImageType; + typedef otb::VectorDataToImageFilter VectorDataToImageFilterType; + VectorDataToImageFilterType::Pointer vectorDataRendering = VectorDataToImageFilterType::New(); + vectorDataRendering->SetInput(projection->GetOutput()); + + //Save the image in a file + typedef otb::ImageFileWriter WriterType; + WriterType::Pointer writer = WriterType::New(); + writer->SetInput(vectorDataRendering); + writer->SetFileName(argv[2]); + writer->Update(); + + return EXIT_SUCCESS; } \ No newline at end of file -- GitLab