Class CRSDistance

Nested Relationships

Nested Types

Inheritance Relationships

Base Type

Derived Type

Class Documentation

class CRSDistance : public gwm::Distance

Class for calculating spatial distance according to coordinate reference system.

Subclassed by gwm::MinkwoskiDistance

Public Functions

inline CRSDistance()

Construct a new CRSDistance object.

inline explicit CRSDistance(bool isGeographic)

Construct a new CRSDistance object. Whether the coordinate reference system is geographical.

CRSDistance(const CRSDistance &distance)

Copy construct a new CRSDistance object. Reference to object for copying.

inline virtual ~CRSDistance()
inline virtual Distance *clone() const override

Clone this Distance object. Newly created pointer.

inline virtual DistanceType type() override

Return the type of this object. Type of distance.

inline bool geographic() const

Get whether the coordinates reference system is geographical. if the coordinate reference system is geographical if the coordinate reference system is not geographical.

inline void setGeographic(bool geographic)

Set whether the coordinates reference system is geographical. Whether the coordinate reference system is geographical.

virtual void makeParameter(std::initializer_list<DistParamVariant> plist) override

Create Parameter for Caclulating CRS Distance. A list of parameters containing 2 items:

  • arma::mat focus points

  • arma::mat data points

virtual arma::vec distance(arma::uword focus) override

Calculate distance vector for a focus point. Focused point’s index. Require focus < total Distance vector for the focused point.

virtual double maxDistance() override

Get maximum distance among all points. Maximum distance.

virtual double minDistance() override

Get minimum distance among all points Maximum distance.

Public Static Functions

static arma::vec SpatialDistance(const arma::rowvec &out_loc, const arma::mat &in_locs)

Calculate spatial distance for points with geographical coordinate reference system. Row-wise vector of focus point’ coordinate. The shape of it must be 1x2 and the first column is longitudes, the second column is latitudes. Matrix of data points’ coordinates. The shape of it must be nx2 and the first column is longitudes, the second column is latitudes. Distance vector for out_loc.

static inline arma::vec EuclideanDistance(const arma::rowvec &out_loc, const arma::mat &in_locs)

Calculate euclidean distance for points with projected coordinate reference system. Row-wise vector of focus point’ coordinate. The shape of it must be 1x2 and the first column is longitudes, the second column is latitudes. Matrix of data points’ coordinates. The shape of it must be nx2 and the first column is longitudes, the second column is latitudes. Distance vector for out_loc.

static double SpGcdist(double lon1, double lon2, double lat1, double lat2)

Calculate spatial distance for two points with geographical coordinate reference system. Longitude of point 1 Longitude of point 2 Latitude of point 1 Latitude of point 2 Spatial distance for point 1 and point 2.

Protected Attributes

bool mGeographic

Whether the CRS is geographic.

std::unique_ptr<Parameter> mParameter

Parameters.

struct Parameter : public gwm::Distance::Parameter

Struct of parameters used in spatial distance calculating according to coordinate reference system.

Public Functions

inline Parameter(const arma::mat &fp, const arma::mat &dp)

Construct a new CRSDistanceParameter object. Reference to focus points Reference to data points.

Public Members

arma::mat focusPoints

Matrix of focus points’ coordinates. The shape of it must be \(n \times 2\) and the first column is longitudes or \(x\)-coordinate, the second column is latitudes or \(y\)-coordinate.

arma::mat dataPoints

Matrix of data points’ coordinates. The shape of it must be \(n \times 2\) and the first column is longitudes or \(x\)-coordinate, the second column is latitudes or \(y\)-coordinate.