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
Joseph Siddons
GeoSpatialTools
Commits
a10a6cf1
Commit
a10a6cf1
authored
6 months ago
by
Joseph Siddons
Browse files
Options
Download
Email Patches
Plain Diff
fix: Don't fix lon to -180, 180 in second query check
parent
35e2ef8f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
8 deletions
+2
-8
GeoSpatialTools/kdtree.py
GeoSpatialTools/kdtree.py
+2
-8
No files found.
GeoSpatialTools/kdtree.py
View file @
a10a6cf1
...
...
@@ -49,12 +49,6 @@ class KDTree:
points
.
sort
(
key
=
lambda
p
:
getattr
(
p
,
self
.
variable
))
split_index
=
n_points
//
2
self
.
partition_value
=
getattr
(
points
[
split_index
-
1
],
self
.
variable
)
# while (
# split_index < n_points
# and getattr(points[split_index], self.variable)
# == self.partition_value
# ):
# split_index += 1
self
.
split
=
True
...
...
@@ -119,9 +113,9 @@ class KDTree:
def
query
(
self
,
point
)
->
tuple
[
list
[
Record
],
float
]:
"""Find the nearest Record within the KDTree to a query Record"""
if
point
.
lon
<
0
:
point2
=
Record
(
point
.
lon
+
360
,
point
.
lat
)
point2
=
Record
(
point
.
lon
+
360
,
point
.
lat
,
fix_lon
=
False
)
else
:
point2
=
Record
(
point
.
lon
-
360
,
point
.
lat
)
point2
=
Record
(
point
.
lon
-
360
,
point
.
lat
,
fix_lon
=
False
)
r1
,
d1
=
self
.
_query
(
point
)
r2
,
d2
=
self
.
_query
(
point2
)
...
...
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