OTB  9.0.0
Orfeo Toolbox
otbPlaceNameToLonLat.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2022 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:
43  typedef itk::SmartPointer<Self> Pointer;
44  typedef itk::SmartPointer<const Self> ConstPointer;
45 
46  typedef itk::Object Superclass;
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  {
64  }
65  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
66  void RetrieveXML(const std::ostringstream& urlStream);
67  void ParseXMLYahoo();
68  void ParseXMLGoogle();
69  void ParseXMLGeonames();
70 
71 private:
72  PlaceNameToLonLat(const Self&) = delete;
73  void operator=(const Self&) = delete;
74 
75  double m_Lon;
76  double m_Lat;
77  std::string m_PlaceName;
78 
80  std::string m_CurlOutput;
82 };
83 
84 } // namespace otb
85 
86 #endif
otb::CurlHelperInterface::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbCurlHelperInterface.h:47
otb::PlaceNameToLonLat::m_CurlOutput
std::string m_CurlOutput
Definition: otbPlaceNameToLonLat.h:80
otb::PlaceNameToLonLat::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbPlaceNameToLonLat.h:44
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::PlaceNameToLonLat::m_Curl
CurlHelperInterface::Pointer m_Curl
Definition: otbPlaceNameToLonLat.h:79
otb::PlaceNameToLonLat::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbPlaceNameToLonLat.h:43
otb::PlaceNameToLonLat::Self
PlaceNameToLonLat Self
Definition: otbPlaceNameToLonLat.h:42
otb::PlaceNameToLonLat::m_Lat
double m_Lat
Definition: otbPlaceNameToLonLat.h:76
otbCurlHelperInterface.h
otb::PlaceNameToLonLat::m_PlaceName
std::string m_PlaceName
Definition: otbPlaceNameToLonLat.h:77
otb::PlaceNameToLonLat::~PlaceNameToLonLat
~PlaceNameToLonLat() override
Definition: otbPlaceNameToLonLat.h:62
otb::PlaceNameToLonLat::m_RequestSucceed
bool m_RequestSucceed
Definition: otbPlaceNameToLonLat.h:81
otb::PlaceNameToLonLat::m_Lon
double m_Lon
Definition: otbPlaceNameToLonLat.h:75
otb::PlaceNameToLonLat::Superclass
itk::Object Superclass
Definition: otbPlaceNameToLonLat.h:46
otb::PlaceNameToLonLat
Retrieve Longitude and Latitude coordinates from a place name.
Definition: otbPlaceNameToLonLat.h:38