diff --git a/GeoSpatialTools/octtree.py b/GeoSpatialTools/octtree.py index d989bbc9d927b149bc778603e8b399ca72cb67f8..a82a2be623f46f99b355e85cf66817aca99683ee 100644 --- a/GeoSpatialTools/octtree.py +++ b/GeoSpatialTools/octtree.py @@ -80,6 +80,15 @@ class SpaceTimeRecord: and (not (self.uid or other.uid) or self.uid == other.uid) ) + def distance(self, other: object) -> float: + """ + Compute the Haversine distance to another SpaceTimeRecord. + Only computes spatial distance. + """ + if not isinstance(other, SpaceTimeRecord): + raise TypeError("Argument other must be an instance of Record") + return haversine(self.lon, self.lat, other.lon, other.lat) + class SpaceTimeRecords(List[SpaceTimeRecord]): """List of SpaceTimeRecords"""