xapian-core
1.4.27
|
A latitude-longitude coordinate. More...
#include <geospatial.h>
Public Member Functions | |
LatLongCoord () | |
Construct an uninitialised coordinate. | |
LatLongCoord (double latitude_, double longitude_) | |
Construct a coordinate. | |
void | unserialise (const std::string &serialised) |
Unserialise a string and set this object to its coordinate. | |
void | unserialise (const char **ptr, const char *end) |
Unserialise a buffer and set this object to its coordinate. | |
std::string | serialise () const |
Return a serialised representation of the coordinate. | |
bool | operator< (const LatLongCoord &other) const |
Compare with another LatLongCoord. | |
std::string | get_description () const |
Return a string describing this object. | |
Public Attributes | |
double | latitude |
A latitude, as decimal degrees. | |
double | longitude |
A longitude, as decimal degrees. | |
A latitude-longitude coordinate.
Experimental - see https://xapian.org/docs/deprecation#experimental-features
Note that latitude-longitude coordinates are only precisely meaningful if the datum used to define them is specified. This class ignores this issue - it is up to the caller to ensure that the datum used for each coordinate in a system is consistent.
Xapian::LatLongCoord::LatLongCoord | ( | double | latitude_, |
double | longitude_ | ||
) |
Construct a coordinate.
If the supplied longitude is out of the standard range, it will be normalised to the range 0 <= longitude < 360.
If you want to avoid the checks (for example, you know that your values are already in range), you can use the alternate constructor to construct an uninitialised coordinate, and then set the latitude and longitude directly.
InvalidArgumentError | the supplied latitude is out of range. |
|
inline |
Compare with another LatLongCoord.
This is mostly provided so that things like std::map<LatLongCoord> work
void Xapian::LatLongCoord::unserialise | ( | const char ** | ptr, |
const char * | end | ||
) |
Unserialise a buffer and set this object to its coordinate.
The buffer may contain further data after that for the coordinate.
ptr | A pointer to the start of the string. This will be updated to point to the end of the data representing the coordinate. |
end | A pointer to the end of the string. |
Xapian::SerialisationError | if the string does not start with a valid serialised latitude-longitude pair. |
void Xapian::LatLongCoord::unserialise | ( | const std::string & | serialised | ) |
Unserialise a string and set this object to its coordinate.
serialised | the string to unserialise the coordinate from. |
Xapian::SerialisationError | if the string does not contain a valid serialised latitude-longitude pair, or contains extra data at the end of it. |
double Xapian::LatLongCoord::latitude |
A latitude, as decimal degrees.
Should be in the range -90 <= latitude <= 90
Positive latitudes represent the northern hemisphere.
Referenced by operator<().
double Xapian::LatLongCoord::longitude |
A longitude, as decimal degrees.
Will be wrapped around, so for example, -150 is equal to 210. When obtained from a serialised form, will be in the range 0 <= longitude < 360.
Longitudes increase as coordinates move eastwards.
Referenced by operator<().