xapian-core
1.4.24
|
Calculate the great-circle distance between two coordinates on a sphere. More...
#include <geospatial.h>
Public Member Functions | |
GreatCircleMetric () | |
Construct a GreatCircleMetric. | |
GreatCircleMetric (double radius_) | |
Construct a GreatCircleMetric using a specified radius. | |
double | pointwise_distance (const LatLongCoord &a, const LatLongCoord &b) const |
Return the great-circle distance between points on the sphere. | |
LatLongMetric * | clone () const |
Clone the metric. | |
std::string | name () const |
Return the full name of the metric. | |
std::string | serialise () const |
Serialise object parameters into a string. | |
LatLongMetric * | unserialise (const std::string &serialised) const |
Create object given string serialisation returned by serialise(). | |
Public Member Functions inherited from Xapian::LatLongMetric | |
virtual | ~LatLongMetric () |
Destructor. | |
double | operator() (const LatLongCoords &a, const LatLongCoords &b) const |
Return the distance between two coordinate lists, in metres. | |
double | operator() (const LatLongCoords &a, const std::string &b) const |
Return the distance between two coordinate lists, in metres. | |
double | operator() (const LatLongCoords &a, const char *b_ptr, size_t b_len) const |
Return the distance between two coordinate lists, in metres. | |
Calculate the great-circle distance between two coordinates on a sphere.
Experimental - see https://xapian.org/docs/deprecation#experimental-features
This uses the haversine formula to calculate the distance. Note that this formula is subject to inaccuracy due to numerical errors for coordinates on the opposite side of the sphere.
Xapian::GreatCircleMetric::GreatCircleMetric | ( | ) |
Construct a GreatCircleMetric.
The (quadratic mean) radius of the Earth will be used by this calculator.
|
explicit |
Construct a GreatCircleMetric using a specified radius.
This is useful for data sets in which the points are not on Earth (eg, a database of features on Mars).
radius_ | The radius of the sphere to use, in metres. |
|
virtual |
Clone the metric.
Implements Xapian::LatLongMetric.
|
virtual |
Return the full name of the metric.
This is used when serialising and unserialising metrics; for example, for performing remote searches.
If the subclass is in a C++ namespace, the namespace should be included in the name, using "::" as a separator. For example, for a LatLongMetric subclass called "FooLatLongMetric" in the "Xapian" namespace the result of this call should be "Xapian::FooLatLongMetric".
Implements Xapian::LatLongMetric.
|
virtual |
Return the great-circle distance between points on the sphere.
Implements Xapian::LatLongMetric.
|
virtual |
Serialise object parameters into a string.
The serialised parameters should represent the configuration of the metric.
Implements Xapian::LatLongMetric.
|
virtual |
Create object given string serialisation returned by serialise().
serialised | A serialised instance of this LatLongMetric subclass. |
Implements Xapian::LatLongMetric.