mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2026-04-02 10:21:01 +01:00
x/y distances between explicit data and survey points
This commit is contained in:
@@ -158,9 +158,11 @@ class Cave(TroggleModel):
|
||||
for e in CaveAndEntrance.objects.filter(cave=self):
|
||||
if e.entrance.best_station() and e.entrance.best_station() != "":
|
||||
#print(self, e, e.entrance.best_station())
|
||||
if e.entrance.best_station_object().x:
|
||||
# print(f"{self} {e.entrance.best_station_object()} {e.entrance.best_station_object().x}")
|
||||
try:
|
||||
x = e.entrance.best_station_object().x
|
||||
no_data = False
|
||||
except:
|
||||
pass
|
||||
return no_data
|
||||
|
||||
def singleentrance(self):
|
||||
|
||||
@@ -58,6 +58,7 @@ class SurvexStation(models.Model):
|
||||
x = models.FloatField(blank=True, null=True)
|
||||
y = models.FloatField(blank=True, null=True)
|
||||
z = models.FloatField(blank=True, null=True)
|
||||
entrance = models.ForeignKey("Entrance", blank=True, null=True, on_delete=models.SET_NULL)
|
||||
|
||||
class Meta:
|
||||
ordering = ("id",)
|
||||
|
||||
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user