diff --git a/Testing/Code/Common/otbVectorDataToImageFilter.cxx b/Testing/Code/Common/otbVectorDataToImageFilter.cxx index 4671cca8840bbef9c1f9aa4a0c362c5dc6a9f1e0..d0cd55ef690ae8f35cc5bd3ffab35ca216d6617c 100644 --- a/Testing/Code/Common/otbVectorDataToImageFilter.cxx +++ b/Testing/Code/Common/otbVectorDataToImageFilter.cxx @@ -28,13 +28,16 @@ #include "otbImage.h" #include "otbVectorDataToImageFilter.h" -// ./mapnikOTBClasses /home/christop/OTB/trunk/OTB-Data/Input/waterways.shp output.png -// ./mapnikOTBClasses ~/OTB/trunk/OTB-Data/Input/ToulouseRoad-examples.shp output.png -// ./mapnikOTBClasses ~/OTB/trunk/OTB-Data/LargeInput/VECTOR/MidiPyrenees/roads.shp output.png - int otbVectorDataToImageFilter(int argc, char * argv[]) { + if (argc < 3 ) + { + std::cout << argv[0] <<" <input vector filename> <input image filename>" << std::endl; + + return EXIT_FAILURE; + } + //Read the vector data typedef otb::VectorData<> VectorDataType; typedef otb::VectorDataFileReader<VectorDataType> VectorDataFileReaderType; @@ -46,7 +49,7 @@ int otbVectorDataToImageFilter(int argc, char * argv[]) typedef otb::VectorDataProjectionFilter<VectorDataType, VectorDataType> ProjectionFilterType; ProjectionFilterType::Pointer projection = ProjectionFilterType::New(); projection->SetInput(reader->GetOutput()); -// projection->Update(); + std::string projectionRefWkt ="PROJCS[\"UTM Zone 31, Northern Hemisphere\",GEOGCS[\"WGS 84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS 84\",6378137,298.257223563,AUTHORITY[\"EPSG\",\"7030\"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY[\"EPSG\",\"6326\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9108\"]],AXIS[\"Lat\",NORTH],AXIS[\"Long\",EAST],AUTHORITY[\"EPSG\",\"4326\"]],PROJECTION[\"Transverse_Mercator\"],PARAMETER[\"latitude_of_origin\",0],PARAMETER[\"central_meridian\",3],PARAMETER[\"scale_factor\",0.9996],PARAMETER[\"false_easting\",500000],PARAMETER[\"false_northing\",0],UNIT[\"Meter\",1]]"; projection->SetOutputProjectionRef(projectionRefWkt); @@ -59,20 +62,14 @@ int otbVectorDataToImageFilter(int argc, char * argv[]) typedef otb::Image<PixelType,2> ImageType; ImageType::SizeType size; -// size[0] = 1000; -// size[1] = 1000; size[0] = 500; size[1] = 500; ImageType::PointType origin; -// origin[0] = 1.3769;//UL lon -// origin[1] = 43.5455;//UL lat origin[0] = 374149.980555821;//UL easting origin[1] = 4829183.99443839;//UL northing ImageType::SpacingType spacing; -// spacing[0] = 0.00002; -// spacing[1] = -0.00002; spacing[0] = 0.6; spacing[1] = -0.6; @@ -98,7 +95,6 @@ int otbVectorDataToImageFilter(int argc, char * argv[]) vectorDataRendering->SetOrigin(origin); vectorDataRendering->SetSpacing(spacing); - //Save the image in a file typedef otb::ImageFileWriter<ImageType> WriterType; WriterType::Pointer writer = WriterType::New(); @@ -106,7 +102,5 @@ int otbVectorDataToImageFilter(int argc, char * argv[]) writer->SetFileName(argv[2]); writer->Update(); - - return EXIT_SUCCESS; } diff --git a/Testing/Code/Projections/otbVectorDataProjectionFilterFromMapToSensor.cxx b/Testing/Code/Projections/otbVectorDataProjectionFilterFromMapToSensor.cxx index 70e4aeb4320dea06eccf26ec82af00b17cc45505..446f15376ac5280eb43c50e870ccf45d4d3ae5dc 100644 --- a/Testing/Code/Projections/otbVectorDataProjectionFilterFromMapToSensor.cxx +++ b/Testing/Code/Projections/otbVectorDataProjectionFilterFromMapToSensor.cxx @@ -27,7 +27,7 @@ int otbVectorDataProjectionFilterFromMapToSensor(int argc, char * argv[]) { - if (argc < 3 ) + if (argc < 4 ) { std::cout << argv[0] <<" <input vector filename> <input image filename>" << " <output vector filename> " << std::endl;