summaryrefslogtreecommitdiffstats
path: root/core/views
diff options
context:
space:
mode:
authorPhilip Sargent <philip.sargent@gmail.com>2023-10-11 01:03:28 +0300
committerPhilip Sargent <philip.sargent@gmail.com>2023-10-11 01:03:28 +0300
commitd6a30064449bfdc089f92f0e3101158c08974a6f (patch)
tree18dae2e04667ec3488c8f1326919367cf54744f1 /core/views
parent973f9bedd5cf260ae224bd0d7ba7a888cd85c579 (diff)
downloadtroggle-d6a30064449bfdc089f92f0e3101158c08974a6f.tar.gz
troggle-d6a30064449bfdc089f92f0e3101158c08974a6f.tar.bz2
troggle-d6a30064449bfdc089f92f0e3101158c08974a6f.zip
x/y distances between explicit data and survey points
Diffstat (limited to 'core/views')
-rw-r--r--core/views/statistics.py49
1 files changed, 37 insertions, 12 deletions
diff --git a/core/views/statistics.py b/core/views/statistics.py
index 2927bd3..c1a0ca8 100644
--- a/core/views/statistics.py
+++ b/core/views/statistics.py
@@ -1,4 +1,5 @@
from collections import OrderedDict
+from math import sqrt
from pathlib import Path
from django.shortcuts import render
@@ -276,15 +277,10 @@ def dataissues(request):
def eastings(request):
"""report each Northing/Easting pair wherever recorded"""
- ents = []
- entrances = Entrance.objects.all()
- for e in entrances:
- if e.easting or e.northing:
- ents.append(e)
- if e.lat_wgs84 or e.long_wgs84:
- ents.append(e)
-
- for e in ents:
+ ents = set()
+ gpsents = set()
+
+ def add_stations(e):
try:
ts = e.tag_station
if ts:
@@ -306,10 +302,39 @@ def eastings(request):
e.tag_es = None
e.tag_os = None
# print(f"exception for {e}")
-
- stations = SurvexStation.objects.all()
+
+ entrances = Entrance.objects.all()
+ for e in entrances:
+ if e.easting or e.northing:
+ ents.add(e)
+ add_stations(e)
+ e.northing = float(e.northing)
+ e.easting = float(e.easting)
+
+ if e.northing < 5200000:
+ e.bmn = True
+ # e.northing = e.northing + 5200000
+ e.northing = e.northing + 5198919.918
+
+ #e.easting = e.easting - 36000 + 486000
+ e.easting = e.easting + 374854.63 # linear hack
+
+ try:
+ e.diffx = e.easting - e.best_station_object().x
+ e.diffy = e.northing - e.best_station_object().y
+ e.error = sqrt(e.diffx**2 + e.diffy**2)
+ except:
+ pass
+
+ for e in entrances:
+ if e.lat_wgs84 or e.long_wgs84:
+ gpsents.add(e)
+ add_stations(e)
+
+
+ stations = SurvexStation.objects.all() # NB these are NOT all the stations in troggle_import_root.pos
- return render(request, "eastings.html", {"ents": ents, "stations": stations})
+ return render(request, "eastings.html", {"ents": ents, "gpsents": gpsents, "stations": stations})
def aliases(request, year):