Commit 93a71540 authored by Otmane Lahlou's avatar Otmane Lahlou

ENH : use osm xml file to avoid proxy issues

parent 43be77eb
......@@ -2613,6 +2613,7 @@ ADD_TEST(ioTvOSMToVectorDataGeneratorTest ${IO_TESTS19}
${BASELINE_FILES}/ioTvOSMToVectorDataFilterTest_highway.shp
${TEMP}/ioTvOSMToVectorDataFilterTest_highway.shp
otbOSMToVectorDataGeneratorTest
${INPUTDATA}/qb_road.osm
${TEMP}/ioTvOSMToVectorDataFilterTest_highway.shp
)
......@@ -2630,13 +2631,13 @@ ADD_TEST(ioTuImageToOSMVectorDataGeneratorNew ${IO_TESTS19}
otbImageToOSMVectorDataGeneratorNew
)
ADD_TEST(ioTvImageToOSMVectorDataGenerator ${IO_TESTS19}
--compare-ogr ${EPSILON_9}
${BASELINE_FILES}/ioTvImageToOSMVectorDataGenerator_highway_motorway.shp
${TEMP}/ioTvImageToOSMVectorDataGenerator_highway_motorway.shp
otbImageToOSMVectorDataGenerator
-in ${EXAMPLEDATA}/qb_RoadExtract.tif
-osm ${INPUTDATA}/qb_road.osm
-out ${TEMP}/ioTvImageToOSMVectorDataGenerator_highway_motorway.shp
-key highvay,motorway
)
......
......@@ -52,6 +52,7 @@ int otbImageToOSMVectorDataGenerator(int argc, char * argv[])
parser->AddInputImage();
parser->AddOption("--OutputVectorData","Output VectorData","-out",true);
parser->AddOption("--Key","Key to search in the XML OSM file","-key",1, false);
parser->AddOption("--OSM","OSM XML file to be parsed","-osm",1, false);
typedef otb::CommandLineArgumentParseResult ParserResultType;
ParserResultType::Pointer parseResult = ParserResultType::New();
......@@ -77,6 +78,11 @@ int otbImageToOSMVectorDataGenerator(int argc, char * argv[])
// VectorData generator instanciation
FilterType::Pointer vdgenerator = FilterType::New();
vdgenerator->SetInput(reader->GetOutput());
if(parseResult->IsOptionPresent("--OSM"))
{
vdgenerator->SetUseUrl(false);
vdgenerator->SetFileName(parseResult->GetParameterString("--OSM"));
}
vdgenerator->Update();
// Split the classes to get classes and values
......@@ -98,7 +104,8 @@ int otbImageToOSMVectorDataGenerator(int argc, char * argv[])
keyvalueList.push_back(currentkeyvalue);
}
std::cout <<"Searching for class "<<keyvalueList[0].first << " and subclass "<< keyvalueList[0].second << std::endl;
std::cout <<"Searching for class "<<keyvalueList[0].first
<< " and subclass "<< keyvalueList[0].second << std::endl;
// Write the generated vector data
......
......@@ -34,12 +34,14 @@ int otbOSMToVectorDataGeneratorNew (int argc, char * argv[])
int otbOSMToVectorDataGeneratorTest (int argc, char * argv[])
{
FilterType::Pointer filter = FilterType::New();
filter->SetFileName(argv[1]);
filter->SetUseUrl(false);
filter->Update();
// Write the IndexTile
VectorDataFileWriterType::Pointer writer = VectorDataFileWriterType::New();
writer->SetInput(filter->GetVectorDataByName("highway"));
writer->SetFileName(argv[1]);
writer->SetInput(filter->GetVectorDataByName("building"));
writer->SetFileName(argv[2]);
writer->Update();
return EXIT_SUCCESS;
......
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