Skip to content
Snippets Groups Projects
Commit 558e3586 authored by Emmanuel Christophe's avatar Emmanuel Christophe
Browse files

ENH: clean file after information retrieval

parent f428b59f
No related branches found
No related tags found
No related merge requests found
......@@ -34,6 +34,7 @@ CoordinateToName::CoordinateToName()
m_Lat = -1000.0;
m_PlaceName = "";
m_CountryName = "";
m_TempFileName = "out-SignayriUt1.xml";
}
/**
......@@ -91,7 +92,7 @@ void CoordinateToName::RetrieveXML(std::ostringstream& urlStream)
CURL *curl;
CURLcode res;
FILE* output_file = fopen("out.xml","w");
FILE* output_file = fopen(m_TempFileName.c_str(),"w");
curl = curl_easy_init();
// std::cout << "URL data " << urlStream.str().data() << std::endl;
......@@ -123,7 +124,7 @@ void CoordinateToName::RetrieveXML(std::ostringstream& urlStream)
void CoordinateToName::ParseXMLGeonames()
{
TiXmlDocument doc( "out.xml" );
TiXmlDocument doc( m_TempFileName.c_str() );
doc.LoadFile();
TiXmlHandle docHandle( &doc );
......@@ -137,6 +138,8 @@ void CoordinateToName::ParseXMLGeonames()
{
m_CountryName=childCountryName->GetText();
}
remove(m_TempFileName.c_str());
}
} // namespace otb
......
......@@ -28,7 +28,6 @@ namespace otb
* \class CoordinateToName
* \brief Retrieve Geographical information for Longitude and Latitude coordinates
*
*/
......@@ -72,6 +71,7 @@ private:
double m_Lat;
std::string m_PlaceName;
std::string m_CountryName;
std::string m_TempFileName;
};
} // namespace otb
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment