From a2bddaeb89c7d5ada35aaade93d06196672ec0bc Mon Sep 17 00:00:00 2001 From: Philip Sargent Date: Wed, 11 Oct 2023 23:26:41 +0300 Subject: [PATCH] tooling to check unevidenced locations --- core/forms.py | 6 ++--- core/views/statistics.py | 43 ++++++++++++++++++++----------- templates/eastings.html | 55 +++++----------------------------------- 3 files changed, 38 insertions(+), 66 deletions(-) diff --git a/core/forms.py b/core/forms.py index 3127bb1..ed334f6 100644 --- a/core/forms.py +++ b/core/forms.py @@ -175,10 +175,10 @@ class EntranceForm(ModelForm): widget=forms.TextInput(attrs={"size": "50"}), label="Other station: Survex station id, e.g. 1623.2023-xx-01.33" ) northing = forms.CharField( - required=False, widget=forms.TextInput(attrs={"size": "10"}), label="Northing (UTM) - from survex data" + required=False, widget=forms.TextInput(attrs={"size": "10"}), label="Northing (UTM) - random shit, being expunged" ) easting = forms.CharField( - required=False, widget=forms.TextInput(attrs={"size": "10"}), label="Easting (UTM) - from survex data" + required=False, widget=forms.TextInput(attrs={"size": "10"}), label="Easting (UTM) - random shit, being expunged" ) lat_wgs84 = forms.CharField( required=False, widget=forms.TextInput(attrs={"size": "10"}), label="Latitude (WSG84) - if no other location" @@ -189,7 +189,7 @@ class EntranceForm(ModelForm): alt = forms.CharField(required=False, label="Altitude (m)") url = forms.CharField(required=False, label="URL [usually blank]", widget=forms.TextInput(attrs={"size": "45"})) - field_order = ['name', 'entrance_description', 'explorers', 'map_description', 'location_description', 'lastvisit', 'approach', 'underground_description', 'photo', 'marking_comment', 'findability_description', 'other_description', 'bearings', 'tag_station', 'exact_station', 'other_station', 'northing', 'easting', 'lat_wgs84', 'long_wgs84', 'alt', 'url'] + field_order = ['name', 'entrance_description', 'explorers', 'map_description', 'location_description', 'lastvisit', 'approach', 'underground_description', 'photo', 'marking_comment', 'findability_description', 'other_description', 'bearings', 'tag_station', 'exact_station', 'other_station', 'easting', 'northing', 'lat_wgs84', 'long_wgs84', 'alt', 'url'] class Meta: model = Entrance diff --git a/core/views/statistics.py b/core/views/statistics.py index c1a0ca8..7e29f5e 100644 --- a/core/views/statistics.py +++ b/core/views/statistics.py @@ -305,26 +305,39 @@ def eastings(request): entrances = Entrance.objects.all() for e in entrances: - if e.easting or e.northing: + if e.exact_station: ents.add(e) add_stations(e) - e.northing = float(e.northing) - e.easting = float(e.easting) + # 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 + # if e.northing < 5200000: + # e.bmn = True + # e.bmn_n = e.northing + # # 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 + # e.bmn_e = e.easting + # #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 + # if e.alt: + # e.alt = e.alt.replace("m","") + + # #print(f"{e.slug} '{e.alt}'") + # e.bmn_alt = e.alt + # else: + # e.bmn_alt = 1000 + # e.pslug = e.slug.replace("1623-","x") + # 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: diff --git a/templates/eastings.html b/templates/eastings.html index a269ba5..17b19b2 100644 --- a/templates/eastings.html +++ b/templates/eastings.html @@ -34,49 +34,9 @@ th, td { padding-right: 5px; -

OK now for the nasty bit. Many of the older caves did not have easting & northing in UTM 33T at all, but (probably) in BMN and converting between BMN into UTM requires ellipsoids and bessel functions.. or we can just take a linear approximation, which is what I have done here:
-e.northingUTM = e.northingBMN + 5198919.918
-e.eastingUTM = e.easting + 374854.63
-Such converted eastings and northings are in italics in the table below. As you can see, some were wildly out. Well they were until I swapped teh easting/northings around and dealt with obvious typos. -

These magic numbers simply come from assuming that both BMN and UTM are in metres, and linear over our area, and then taking the avergage of the offsets for 5 locations, the 5 cave entrances at the bottom of this page: -Olaf's Coordinates. -

This horrible approximation is accruate to ~8m in the northing and ~30m in the easting. -BMN - - - - -{% for ent in ents %} - - - - - - - - - - - - - -{% endfor %} -
CaveEntrance slugEastingNorthingbest tag eastingbest tag northingΔ xΔ yDistance (m)
- {% for c in ent.cavelist %} - - {% if c.official_name %} - {{c.official_name|safe}} - {% else %} - {{c|safe}} - {% endif %}
- {% endfor %}
{{ent.slug}}{{ent.easting|floatformat:2}}{{ent.northing|floatformat:2}}{{ent.best_station_object.x|floatformat:2}}{{ent.best_station_object.y|floatformat:2}}{{ent.diffx|floatformat:0}}{{ent.diffy|floatformat:0}}{{ent.error|floatformat:0}}
-

For Radost's tool, but remember, these are hacked-up BMN conversions, not real.
-{% for ent in ents %} -33T {{ent.easting|floatformat:1}} {{ent.northing|floatformat:1}}
-{% endfor %}

{% for ent in ents %} -*fix x{{ent.slug}} {{ent.easting|floatformat:2}} {{ent.northing|floatformat:2}} {{ent.alt|floatformat:0}}
+*fix {{ent.pslug}} {{ent.bmn_e|floatformat:0}} {{ent.bmn_n|floatformat:0}} {{ent.bmn_alt|floatformat:0}}
{% endfor %}

and what those stations are: @@ -108,7 +68,11 @@ Such converted eastings and northings are in italics in the table below

and now the GPS equivalents

- + + + + + {% for ent in gpsents %} + @@ -128,12 +93,6 @@ Such converted eastings and northings are in italics in the table below - - - - - - {% endfor %}
CaveGPS LatGPS Longbest Latbest Longtagtag Lattag Longtag exactexact Latexact Longtag otherother Latother Long
CaveAltGPS LatGPS Longbest Latbest Longtagtag Lattag Long
@@ -121,6 +85,7 @@ Such converted eastings and northings are in italics in the table below {% endif %}
{% endfor %}
{{ent.alt|floatformat:1}} {{ent.lat_wgs84|floatformat:6}} {{ent.long_wgs84|floatformat:6}} {{ent.lat|floatformat:6}}{{ent.tag_station}} {{ent.tag_ts.lat|floatformat:6}} {{ent.tag_ts.long|floatformat:6}}{{ent.exact_station}}{{ent.tag_es.lat|floatformat:6}}{{ent.tag_es.long|floatformat:6}}{{ent.other_station}}{{ent.tag_os.lat|floatformat:6}}{{ent.tag_os.long|floatformat:6}}