geolocation.h Source File
|
CPP API
|
geolocation.h
Go to the documentation of this file.
4 * Authors: Kilian Volmer, Sascha Korf, Carlotta Gerstein, Daniel Abele, Elisabeth Kluth, Khoa Nguyen, David Kerkmann
109 return Members("GeographicalLocation").add("latitude", m_latitude).add("longitude", m_longitude);
117 * Uses the haversine formula (https://en.wikipedia.org/wiki/Haversine_formula) to calculate the distance between
118 * two geographical locations. Uses an earth radius of 6371 km (https://en.wikipedia.org/wiki/Earth_radius).
130 const ScalarType distance = 2.0 * earth_radius.kilometers() * asin(sqrt(first_part + second_part));
ScalarType kilometers() const
return distance in kilometers.
Definition: distance.h:55
Class representing a geographical location on the Earth's surface.
Definition: geolocation.h:42
void set_latitude(ScalarType lat)
Set the latitude object.
Definition: geolocation.h:159
constexpr static mio::geo::Distance earth_radius
Definition: geolocation.h:188
bool operator!=(const GeographicalLocation &other) const
Compare two GeographicalLocations for inequality.
Definition: geolocation.h:86
GeographicalLocation(ScalarType lat, ScalarType lon)
Construct a new Geographical Location object.
Definition: geolocation.h:51
void set_longitude(ScalarType lon)
Set the longitude object.
Definition: geolocation.h:170
ScalarType get_longitude() const
Get the longitude object.
Definition: geolocation.h:149
bool operator==(const GeographicalLocation &other) const
Compare two GeographicalLocations for equality.
Definition: geolocation.h:78
auto default_serialize()
Default serialize the GeographicalLocation object.
Definition: geolocation.h:107
bool is_close(const GeographicalLocation &other, Distance tol=Distance(10 *Limits< ScalarType >::zero_tolerance())) const
Check that this location is within a (small) distance of another.
Definition: geolocation.h:96
ScalarType get_latitude() const
Get the latitude object.
Definition: geolocation.h:139
constexpr static ScalarType radians
Definition: geolocation.h:189
Distance distance(const GeographicalLocation &other) const
Definition: geolocation.h:121
GeographicalLocation(std::pair< ScalarType, ScalarType > coordinates)
Construct a new Geographical Location object.
Definition: geolocation.h:62
void check_input() const
Assert that the latitude and longitude are within valid ranges.
Definition: geolocation.h:180
GeographicalLocation()=default
Construct a new Geographical Location object using the default constructor to keep compatibility with...
ad::internal::unary_intermediate< AD_TAPE_REAL, ad::internal::active_type< AD_TAPE_REAL, DATA_HANDLER_1 >, ad::operations::ad_sin< AD_TAPE_REAL > > sin(const ad::internal::active_type< AD_TAPE_REAL, DATA_HANDLER_1 > &x1)
Definition: ad.hpp:913
ad::internal::unary_intermediate< AD_TAPE_REAL, ad::internal::active_type< AD_TAPE_REAL, DATA_HANDLER_1 >, ad::operations::ad_asin< AD_TAPE_REAL > > asin(const ad::internal::active_type< AD_TAPE_REAL, DATA_HANDLER_1 > &x1)
Definition: ad.hpp:968
ad::internal::unary_intermediate< AD_TAPE_REAL, ad::internal::active_type< AD_TAPE_REAL, DATA_HANDLER_1 >, ad::operations::ad_sqrt< AD_TAPE_REAL > > sqrt(const ad::internal::active_type< AD_TAPE_REAL, DATA_HANDLER_1 > &x1)
Definition: ad.hpp:1023
ad::internal::unary_intermediate< AD_TAPE_REAL, ad::internal::active_type< AD_TAPE_REAL, DATA_HANDLER_1 >, ad::operations::ad_cos< AD_TAPE_REAL > > cos(const ad::internal::active_type< AD_TAPE_REAL, DATA_HANDLER_1 > &x1)
Definition: ad.hpp:924
constexpr Distance kilometers(ScalarType kilometers)
Create a Distance of a specified number of kilometers.
Definition: distance.h:145
A collection of classes to simplify handling of matrix shapes in meta programming.
Definition: models/abm/analyze_result.h:30
Members< ValueTypes..., T > add(const char *member_name, T &member)
Add a class member.
Definition: default_serialize.h:139
Generated by