diff options
-rw-r--r-- | core/forms.py | 12 | ||||
-rw-r--r-- | core/models/caves.py | 17 | ||||
-rw-r--r-- | core/views/prospect.py | 6 | ||||
-rw-r--r-- | core/views/statistics.py | 8 | ||||
-rw-r--r-- | parsers/caves.py | 6 | ||||
-rw-r--r-- | parsers/locations.py | 4 | ||||
-rw-r--r-- | templates/cave.html | 3 | ||||
-rw-r--r-- | templates/dataformat/entrance.xml | 3 | ||||
-rw-r--r-- | templates/eastings.html | 6 | ||||
-rw-r--r-- | templates/entrance_html.kml | 7 |
10 files changed, 14 insertions, 58 deletions
diff --git a/core/forms.py b/core/forms.py index 8eb8f78..23b80ce 100644 --- a/core/forms.py +++ b/core/forms.py @@ -164,15 +164,11 @@ class EntranceForm(ModelForm): ) tag_station = forms.CharField( required=False, - widget=forms.TextInput(attrs={"size": "50"}), label="Tag station: Survex station id, e.g. 1623.p2023-xx-01" - ) - exact_station = forms.CharField( - required=False, - widget=forms.TextInput(attrs={"size": "50"}), label="Exact station: Survex station id, e.g. 1623.2023-xx-01.2" + widget=forms.TextInput(attrs={"size": "50"}), label="Tag station: Survex station id, e.g. 1623.p2023-aa-01" ) other_station = forms.CharField( required=False, - widget=forms.TextInput(attrs={"size": "50"}), label="Other station: Survex station id, e.g. 1623.2023-xx-01.33" + widget=forms.TextInput(attrs={"size": "50"}), label="Other station: Survex station id, e.g. 1623.gps2018-aa-01" ) lat_wgs84 = forms.CharField( @@ -181,10 +177,10 @@ class EntranceForm(ModelForm): long_wgs84 = forms.CharField( required=False, widget=forms.TextInput(attrs={"size": "10"}), label="Longitude (WSG84) - if no other location" ) - alt = forms.CharField(required=False, label="Altitude (m)") + alt = forms.CharField(required=False, label="Altitude (m) - from GPS if you have it, but let it settle.") 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', 'easting', 'northing', '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', 'other_station', 'easting', 'northing', 'lat_wgs84', 'long_wgs84', 'alt', 'url'] class Meta: model = Entrance diff --git a/core/models/caves.py b/core/models/caves.py index bd35461..433ef87 100644 --- a/core/models/caves.py +++ b/core/models/caves.py @@ -256,7 +256,6 @@ class Entrance(TroggleModel): url = models.CharField(max_length=300, blank=True, null=True) tag_station = models.TextField(blank=True, null=True) - exact_station = models.TextField(blank=True, null=True) other_station = models.TextField(blank=True, null=True) class Meta: @@ -298,9 +297,6 @@ class Entrance(TroggleModel): letter = ce.entranceletter print(f"### LETTER {letter}") return letter - - def exact_location(self): - return self.single(self.exact_station) def other_location(self): return self.single(self.other_station) @@ -313,12 +309,6 @@ class Entrance(TroggleModel): return r + f"{s.x:0.0f}E {s.y:0.0f}N {s.z:0.0f}Alt" except: return r + f"{self.tag_station} Tag Station not in dataset" - if self.exact_station: - try: - s = SurvexStation.objects.lookup(self.exact_station) - return r + f"{s.x:0.0f}E {s.y:0.0f}N {s.z:0.0f}Alt" - except: - return r + f"{self.tag_station} Exact Station not in dataset" if self.other_station: try: s = SurvexStation.objects.lookup(self.other_station) @@ -334,8 +324,6 @@ class Entrance(TroggleModel): def best_station(self): if self.tag_station: return self.tag_station - if self.exact_station: - return self.exact_station if self.other_station: return self.other_station @@ -433,11 +421,6 @@ class Entrance(TroggleModel): station = SurvexStation.objects.get(name = self.tag_station) except: pass - if self.exact_station: - try: - station = SurvexStation.objects.get(name = self.exact_station) - except: - pass if station: return station.latlong() diff --git a/core/views/prospect.py b/core/views/prospect.py index e9d3fde..561c6d3 100644 --- a/core/views/prospect.py +++ b/core/views/prospect.py @@ -265,10 +265,8 @@ def prospecting_image(request, name): E, N = e.easting, e.northing if e.tag_station: st = e.tag_station - elif e.exact_station: - st = e.exact_station - elif e.exact_station: - st = e.exact_station + elif e.other_station: + st = e.other_station else: # print(f' No tag - {e.name} ') continue diff --git a/core/views/statistics.py b/core/views/statistics.py index 7e29f5e..6ae1521 100644 --- a/core/views/statistics.py +++ b/core/views/statistics.py @@ -286,11 +286,7 @@ def eastings(request): if ts: e.tag_ts = SurvexStation.objects.get(name=ts) #print(f"{e} {e.tag_ts} {e.tag_ts.lat()} {e.tag_ts.long()}") - - es = e.exact_station - if es: - e.tag_es = SurvexStation.objects.get(name=es) - #print(f"{e} {e.tag_es} {e.tag_es.lat()} {e.tag_es.long()}") + os = e.other_station if os: @@ -305,7 +301,7 @@ def eastings(request): entrances = Entrance.objects.all() for e in entrances: - if e.exact_station: + if e.other_station: ents.add(e) add_stations(e) # if e.easting or e.northing: diff --git a/parsers/caves.py b/parsers/caves.py index 91985d1..c3d2567 100644 --- a/parsers/caves.py +++ b/parsers/caves.py @@ -498,7 +498,6 @@ def read_entrance(filename, ent=None): bearings = getXMLmax1("bearings") easting = getXMLmax1("easting") entrance_description = getXMLmax1("entrance_description") - exact_station = getXMLmax1("exact_station") explorers = getXMLmax1("explorers") findability = getXMLmax1("findability") findability_description = getXMLmax1("findability_description") @@ -524,11 +523,9 @@ def read_entrance(filename, ent=None): ent.alt=alt[0] ent.approach=approach[0] ent.bearings=bearings[0] - ent.easting=easting[0] ent.lat_wgs84=lat_wgs84[0] ent.long_wgs84=long_wgs84[0] ent.entrance_description=entrance_description[0] - ent.exact_station=exact_station[0] ent.explorers=explorers[0] ent.filename=filename ent.findability=findability[0] @@ -538,7 +535,6 @@ def read_entrance(filename, ent=None): ent.map_description=map_description[0] ent.marking=marking[0] ent.marking_comment=marking_comment[0] - ent.northing=northing[0] ent.other_description=other_description[0] ent.other_station=other_station[0] ent.photo=photo[0] @@ -547,7 +543,7 @@ def read_entrance(filename, ent=None): ent.underground_description=underground_description[0] ent.url=url[0] - for st in [ent.exact_station, ent.other_station, ent.tag_station]: + for st in [ent.other_station, ent.tag_station]: #validate_station(st) try: validate_station(st) diff --git a/parsers/locations.py b/parsers/locations.py index acf41b9..568e79b 100644 --- a/parsers/locations.py +++ b/parsers/locations.py @@ -54,7 +54,7 @@ class MapLocations(object): def points(self): prior = len(self.p) for ent in Entrance.objects.all(): - for st, ent_type in {ent.exact_station: "exact", ent.other_station: "other", ent.tag_station: "tag"}.items(): + for st, ent_type in {ent.other_station: "other", ent.tag_station: "tag"}.items(): if st != "": self.p.append((st, str(ent), ent.needs_surface_work(), ent)) store_data_issues() @@ -102,7 +102,7 @@ def validate_entrance_stations(ent=None): else: print(f"BUGGER {ent} {ent.cavelist()}") url="/caves" - for st, ent_type in {ent.exact_station: "exact", ent.other_station: "other", ent.tag_station: "tag"}.items(): + for st, ent_type in {ent.other_station: "other", ent.tag_station: "tag"}.items(): if st == "": continue try: diff --git a/templates/cave.html b/templates/cave.html index 4a6e7d8..870df95 100644 --- a/templates/cave.html +++ b/templates/cave.html @@ -186,9 +186,6 @@ {% if ent.entrance.bearings %} <dt>Bearings</dt><dd>{{ ent.entrance.bearings|safe }}</dd> {% endif %} - {% if ent.entrance.exact_station %} - <dt>Exact Station</dt><dd>{{ ent.entrance.exact_station|safe }}<a href="https://www.openstreetmap.org/?mlat={{ ent.entrance.exact_location.latlong.0}}&mlon={{ent.entrance.exact_location.latlong.1}}"> {{ ent.entrance.exact_location.latlong.0|floatformat:7 }}N {{ ent.entrance.exact_location.latlong.1|floatformat:7 }}E</a> (UTM33 {{ ent.entrance.exact_location.x|floatformat:0 }}, {{ ent.entrance.exact_location.y|floatformat:0 }}), {{ ent.entrance.exact_location.z|floatformat:0 }}m</dd> - {% endif %} {% if ent.entrance.other_station %} <dt>Other Station</dt><dd>{{ ent.entrance.other_station|safe }} {% if ent.entrance.other_description %} diff --git a/templates/dataformat/entrance.xml b/templates/dataformat/entrance.xml index 7c0c775..98ca575 100644 --- a/templates/dataformat/entrance.xml +++ b/templates/dataformat/entrance.xml @@ -47,12 +47,9 @@ though, you do not need to do a data import as it happens automatically --> <findability>{{ entrance.findability|default_if_none:""|safe }}</findability> <findability_description>{{ entrance.findability_description|default_if_none:""|safe }}</findability_description> <alt>{{ entrance.alt|default_if_none:""|safe }}</alt> -<northing>{{ entrance.northing|default_if_none:""|safe }}</northing> -<easting>{{ entrance.easting|default_if_none:""|safe }}</easting> <lat_wgs84>{{ entrance.lat_wgs84|default_if_none:""|safe }}</lat_wgs84> <long_wgs84>{{ entrance.long_wgs84|default_if_none:""|safe }}</long_wgs84> <tag_station>{{ entrance.tag_station|default_if_none:""|safe }}</tag_station> -<exact_station>{{ entrance.exact_station|default_if_none:""|safe }}</exact_station> <other_station>{{ entrance.other_station|default_if_none:""|safe }}</other_station> <other_description>{{ entrance.other_description|default_if_none:""|safe }}</other_description> <bearings>{{ entrance.bearings|default_if_none:""|safe }}</bearings> diff --git a/templates/eastings.html b/templates/eastings.html index 21a40e6..32a628e 100644 --- a/templates/eastings.html +++ b/templates/eastings.html @@ -28,7 +28,7 @@ th, td { <table> <tr><th>Cave</th><th>Ent slug</th> -<th>tag</th><th>tag x</th><th>tag y</th><th>tag exact</th><th>exact x</th><th>exact y</th><th>tag other</th><th>other x</th><th>other y</th></tr> +<th>tag</th><th>tag x</th><th>tag y</th><<th>tag other</th><th>other x</th><th>other y</th></tr> {% for ent in ents %} <tr> <td style="text-align:left"> @@ -45,9 +45,7 @@ th, td { <td style="text-align:right">{{ent.tag_station}}</td> <td style="text-align:right">{{ent.tag_ts.x|floatformat:0}}</td> <td style="text-align:right">{{ent.tag_ts.y|floatformat:0}}</td> - <td style="text-align:right">{{ent.exact_station}}</td> - <td style="text-align:right">{{ent.tag_es.x|floatformat:0}}</td> - <td style="text-align:right">{{ent.tag_es.y|floatformat:0}}</td> + <td style="text-align:right">{{ent.other_station}}</td> <td style="text-align:right">{{ent.tag_os.x|floatformat:0}}</td> <td style="text-align:right">{{ent.tag_os.y|floatformat:0}}</td> diff --git a/templates/entrance_html.kml b/templates/entrance_html.kml index 902102c..a9e50a9 100644 --- a/templates/entrance_html.kml +++ b/templates/entrance_html.kml @@ -33,18 +33,13 @@ {% if entrance.explorers %} <dt>Explorers</dt><dd>{{ entrance.explorers|safe }}</dd> {% endif %} - {% if entrance.northing %} - <dt>Location</dt><dd>?BMN? Northing: {{ entrance.northing|safe }}, Easting: {{ entrance.easting|safe }}, {{ entrance.alt|safe }}m</dd> - {% endif %} {% if entrance.tag_station %} <dt>Tag Location</dt><dd>{{ entrance.tag_station }} {{ entrance.tag.latlong.0|floatformat:5 }}N {{ entrance.tag.latlong.1|floatformat:5 }}E - UTM33 {{ entrance.tag.y|floatformat:0 }}, {{ entrance.tag.x|floatformat:0 }}, {{ entrance.tag.z|floatformat:0 }}m</dd> {% endif %} {% if entrance.bearings %} <dt>Bearings</dt><dd>{{ entrance.bearings|safe }}</dd> {% endif %} - {% if entrance.exact_station %} - <dt>Exact Station</dt><dd>{{ entrance.exact_station|safe }} {{ entrance.exact_location.latlong.0|floatformat:5 }}N {{ entrance.exact_location.latlong.1|floatformat:5 }}E - UTM33 {{ entrance.exact_location.y|floatformat:0 }}, {{ entrance.exact_location.x|floatformat:0 }}, {{ entrance.exact_location.z|floatformat:0 }}m</dd> - {% endif %} + {% if entrance.other_station %} <dt>Other Station</dt><dd>{{ entrance.other_station|safe }} {% if entrance.other_description %} |