Public Member Functions | List of all members
Xapian::GreatCircleMetric Class Reference

Calculate the great-circle distance between two coordinates on a sphere. More...

+ Inheritance diagram for Xapian::GreatCircleMetric:

Public Member Functions

 GreatCircleMetric ()
 Construct a GreatCircleMetric. More...
 
 GreatCircleMetric (double radius_)
 Construct a GreatCircleMetric using a specified radius. More...
 
double pointwise_distance (const LatLongCoord &a, const LatLongCoord &b) const
 Return the great-circle distance between points on the sphere.
 
LatLongMetricclone () const
 Clone the metric. More...
 
std::string name () const
 Return the full name of the metric. More...
 
std::string serialise () const
 Serialise object parameters into a string. More...
 
LatLongMetricunserialise (const std::string &serialised) const
 Create object given string serialisation returned by serialise(). More...
 
- 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. More...
 
double operator() (const LatLongCoords &a, const std::string &b) const
 Return the distance between two coordinate lists, in metres. More...
 
double operator() (const LatLongCoords &a, const char *b_ptr, size_t b_len) const
 Return the distance between two coordinate lists, in metres. More...
 

Detailed Description

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.

See http://en.wikipedia.org/wiki/Haversine_formula

Constructor & Destructor Documentation

Xapian::GreatCircleMetric::GreatCircleMetric ( )

Construct a GreatCircleMetric.

The (quadratic mean) radius of the Earth will be used by this calculator.

Xapian::GreatCircleMetric::GreatCircleMetric ( double  radius_)
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).

Parameters
radius_The radius of the sphere to use, in metres.

Member Function Documentation

LatLongMetric* Xapian::GreatCircleMetric::clone ( ) const
virtual

Clone the metric.

Implements Xapian::LatLongMetric.

std::string Xapian::GreatCircleMetric::name ( ) const
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.

std::string Xapian::GreatCircleMetric::serialise ( ) const
virtual

Serialise object parameters into a string.

The serialised parameters should represent the configuration of the metric.

Implements Xapian::LatLongMetric.

LatLongMetric* Xapian::GreatCircleMetric::unserialise ( const std::string &  serialised) const
virtual

Create object given string serialisation returned by serialise().

Parameters
serialisedA serialised instance of this LatLongMetric subclass.

Implements Xapian::LatLongMetric.


The documentation for this class was generated from the following file:

Documentation for Xapian (version 1.4.0).
Generated on Wed Oct 12 2016 by Doxygen 1.8.11.