A toolkit for working with phylogenetic data.
v0.20.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
utils/tools/geodesy/functions.hpp
Go to the documentation of this file.
1 #ifndef GENESIS_UTILS_TOOLS_GEODESY_FUNCTIONS_H_
2 #define GENESIS_UTILS_TOOLS_GEODESY_FUNCTIONS_H_
3 
4 /*
5  Genesis - A toolkit for working with phylogenetic data.
6  Copyright (C) 2014-2017 Lucas Czech
7 
8  This program is free software: you can redistribute it and/or modify
9  it under the terms of the GNU General Public License as published by
10  the Free Software Foundation, either version 3 of the License, or
11  (at your option) any later version.
12 
13  This program is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with this program. If not, see <http://www.gnu.org/licenses/>.
20 
21  Contact:
22  Lucas Czech <lucas.czech@h-its.org>
23  Exelixis Lab, Heidelberg Institute for Theoretical Studies
24  Schloss-Wolfsbrunnenweg 35, D-69118 Heidelberg, Germany
25 */
26 
35 
36 #include <iosfwd>
37 #include <string>
38 
39 namespace genesis {
40 namespace utils {
41 
42 // =================================================================================================
43 // World Constants
44 // =================================================================================================
45 
49 constexpr double EARTH_MEAN_RADIUS = 6371.0;
50 
51 // =================================================================================================
52 // Coordinate Conversion
53 // =================================================================================================
54 
68 std::string sanitize_geo_coordinate( std::string const& coordinate, bool two_components = true );
69 
76 GeoCoordinate convert_geo_coordinate( std::string const& latitude, std::string const& longitude );
77 
111 GeoCoordinate convert_geo_coordinate( std::string const& coordinate );
112 
113 // =================================================================================================
114 // Distance
115 // =================================================================================================
116 
124 double geo_distance( GeoCoordinate const& c1, GeoCoordinate const& c2 );
125 
126 // =================================================================================================
127 // Printing
128 // =================================================================================================
129 
130 std::ostream& operator<< ( std::ostream& os, GeoCoordinate const& coord );
131 
132 } // namespace utils
133 } // namespace genesis
134 
135 #endif // include guard
GeoCoordinate convert_geo_coordinate(std::string const &latitude, std::string const &longitude)
Parse strings of geographic coordinates.
Geographical coordinates in degrees.
Definition: geodesy.hpp:46
std::ostream & operator<<(std::ostream &os, const Matrix< T > &matrix)
Print the elements of a Matrix to a stream, using operator << for each element.
constexpr double EARTH_MEAN_RADIUS
Earth is not flat!
std::string sanitize_geo_coordinate(std::string const &coordinates, bool two_components)
Replace non-ascii symbols used in geographic coordinates by their ascii equivalents.
double geo_distance(GeoCoordinate const &c1, GeoCoordinate const &c2)
Calculate the distance (in km) between two points on Earth.