Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
NOCSurfaceProcesses
GeoSpatialTools
Commits
cf00a44b
Commit
cf00a44b
authored
5 months ago
by
Joseph Siddons
Browse files
Options
Download
Email Patches
Plain Diff
feat: add distance method to Record class
parent
efe703bc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
1 deletion
+7
-1
GeoSpatialTools/quadtree.py
GeoSpatialTools/quadtree.py
+7
-1
No files found.
GeoSpatialTools/quadtree.py
View file @
cf00a44b
...
...
@@ -41,7 +41,7 @@ class Record:
return
None
def
__str__
(
self
)
->
str
:
return
f
"Record(
x
=
{
self
.
lon
}
,
y
=
{
self
.
lat
}
, datetime =
{
self
.
datetime
}
, uid =
{
self
.
uid
}
)"
return
f
"Record(
lon
=
{
self
.
lon
}
,
lat
=
{
self
.
lat
}
, datetime =
{
self
.
datetime
}
, uid =
{
self
.
uid
}
)"
def
__eq__
(
self
,
other
:
object
)
->
bool
:
return
(
...
...
@@ -52,6 +52,12 @@ class Record:
and
(
not
(
self
.
uid
or
other
.
uid
)
or
self
.
uid
==
other
.
uid
)
)
def
distance
(
self
,
other
:
object
)
->
float
:
"""Compute the Haversine distance to another Record"""
if
not
isinstance
(
other
,
Record
):
raise
TypeError
(
"Argument other must be an instance of Record"
)
return
haversine
(
self
.
lon
,
self
.
lat
,
other
.
lon
,
other
.
lat
)
class
Rectangle
:
"""
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment