summaryrefslogtreecommitdiffstats
path: root/core/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'core/utils.py')
-rw-r--r--core/utils.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/core/utils.py b/core/utils.py
index b46e341..0e0dfcc 100644
--- a/core/utils.py
+++ b/core/utils.py
@@ -38,6 +38,8 @@ TROG = {"pagecache": {"expedition": {}}, "caves": {"gcavelookup": {}, "gcavecoun
alphabet = []
sha = hashlib.new('sha256')
+throw = 35.0
+
# This is module-level executable. This is a Bad Thing. Especially when it touches the file system.
try:
logging.basicConfig(level=logging.DEBUG, filename=settings.LOGFILE, filemode="w")
@@ -299,21 +301,25 @@ def find_nearest_point(points, target_point):
In our dataset, the survey stations are all within 30m of an srtm reference point.
So we can safely ignore points more than 100m away in either x or y directions.
+ This is not true for the 1624 and 1627 areas though.
+
TO DO: store this list twice, once sorted by x and once sorted by y,
do a bounding box search for a set of nearby points before doing the exhaustive pythagorean distance search."""
nearest_distance_squared = float("inf")
nearest_point = None
x_target, y_target = target_point
+
+ max_ds = throw * throw # 1089 = 33 x 33
for point in points:
x, y, z = point
if z < 0:
distance_squared = 1000000.0 # ie ignore it
else:
- if x - x_target > 100:
- distance_squared = 10000
- elif y - y_target > 100:
- distance_squared = 10000
+ if x - x_target > throw:
+ distance_squared = max_ds
+ elif y - y_target > throw:
+ distance_squared = max_ds
else:
distance_squared = math.pow(x - x_target, 2) + math.pow(y - y_target, 2)