OTB  6.7.0
Orfeo Toolbox
otbPlaceNameToLonLat.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES)
3  *
4  * This file is part of Orfeo Toolbox
5  *
6  * https://www.orfeo-toolbox.org/
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  */
20 #ifndef otbPlaceNameToLonLat_h
21 #define otbPlaceNameToLonLat_h
22 
23 #include "otbCurlHelperInterface.h"
24 #include "OTBCartoExport.h"
25 #include <string>
26 
27 namespace otb
28 {
29 
38 class OTBCarto_EXPORT PlaceNameToLonLat : public itk::Object
39 {
40 public:
45 
47 
48  itkTypeMacro(PlaceNameToLonLat, Object);
50  itkNewMacro(Self);
51 
52  itkGetMacro(Lon, double);
53  itkGetMacro(Lat, double);
54  itkGetMacro(PlaceName, std::string);
55 
56  itkSetMacro(PlaceName, std::string);
57 
58  virtual bool Evaluate();
59 
60 protected:
62  ~PlaceNameToLonLat() override {}
63  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
64  void RetrieveXML(const std::ostringstream& urlStream);
65  void ParseXMLYahoo();
66  void ParseXMLGoogle();
67  void ParseXMLGeonames();
68 
69 private:
70  PlaceNameToLonLat(const Self &) = delete;
71  void operator =(const Self&) = delete;
72 
73  double m_Lon;
74  double m_Lat;
75  std::string m_PlaceName;
76 
78  std::string m_CurlOutput;
80 
81 };
82 
83 } // namespace otb
84 
85 #endif
itk::SmartPointer< Self > Pointer
itk::SmartPointer< const Self > ConstPointer
Retrieve Longitude and Latitude coordinates from a place name.
CurlHelperInterface::Pointer m_Curl