6 Commits

8 changed files with 50 additions and 54 deletions

View File

@@ -6,7 +6,7 @@ on:
image_tag:
description: '2. Tag für das Docker-Image (außer latest) (z.B. v1.0.0)'
required: true
default: '0.4.0'
default: '0.6.0'
env:
image_name: mysteryhelfer

View File

@@ -15,7 +15,13 @@ RUN pip install --no-cache-dir -r requirements.txt
COPY ./app /app
COPY ./patch-streamlit/* /usr/local/lib/python3.13/site-packages/streamlit/static/
# ein bisschen Patchen um auch beim Bookmarken oder Versenden der Webadresse per Messenger den richtigen Titel und das
# richtige Favicon zu verwenden/sehen
COPY ./app/images/favicon.ico /usr/local/lib/python3.13/site-packages/streamlit/static/favicon.ico
RUN sed -i -e 's|favicon\.png|favicon.ico|' \
-e 's|<title>.*</title>|<title>tebarius Mysteryhelfer (web)</title>|' \
/usr/local/lib/python3.13/site-packages/streamlit/static/index.html
EXPOSE 8501

View File

@@ -4,6 +4,7 @@ import streamlit as st
import base64
import tools
import matplotlib.pyplot as plt
from helper import show_map_folium
standard_output = ('#### Um den HILFE-Text zu einzelnen Funktionen aufzurufen bitte die Funktion mit leerem'
' Eingabefeld aufrufen.')
@@ -360,7 +361,8 @@ st.markdown(st.session_state.output_text)
# Karte anzeigen, falls aktiviert
if st.session_state.map_data is not None:
st.subheader("Kartenansicht")
st.map(st.session_state.map_data)
show_map_folium(st.session_state.map_data)
if st.session_state.graph_data is not None:
fig, ax = plt.subplots()

View File

@@ -3,6 +3,9 @@
import math
from re import match # für unkennify
import streamlit as st
from streamlit_folium import st_folium
import folium
# ***recursive quersummenfunktion***
def q_sum(n):
@@ -337,3 +340,34 @@ def rail_decrypt(cipher: str, rails: int):
elif down is False:
y -= 1
return out
#from folium.map import DivIcon
def show_map_folium(df):
if not df.empty:
# Schritt 1: Bestimme die südwestliche und nordöstliche Ecke
sw = df[['lat', 'lon']].min().values.tolist() # Südwesten
ne = df[['lat', 'lon']].max().values.tolist() # Nordosten
# Schritt 2: Initialisiere Karte (Ort egal, wird überschrieben, zoom wird bei mehreren Koordinaten überschrieben)
m = folium.Map(location=df[["lat", "lon"]].mean().values.tolist(), zoom_start=15)
# Schritt 3: Marker hinzufügen
for _, row in df.iterrows():
if 'label' in row:
folium.Marker(
location=[row["lat"], row["lon"]],
popup=f"<b>{int(row['label'])}</b><br> Lat:{round(row['lat'], 5)}, Lon:{round(row['lon'], 5)}",
tooltip=f"<b>{int(row['label'])}</b><br> Lat:{round(row['lat'], 5)}, Lon:{round(row['lon'], 5)}",
icon = folium.Icon(color="red", icon="map-marker")
).add_to(m)
else:
folium.Marker(
location=[row["lat"], row["lon"]],
popup=f"Lat:{round(row['lat'], 5)}, Lon:{round(row['lon'], 5)}",
tooltip=f"Lat:{round(row['lat'], 5)}, Lon:{round(row['lon'], 5)}",
icon = folium.Icon(color="red", icon="map-marker")
).add_to(m)
if len(df) != 1:
# Schritt 4: Zoom anpassen bei mehr als einer Koordinate
m.fit_bounds([sw, ne])
# Schritt 5: In Streamlit anzeigen
st_folium(m, use_container_width=True)
else:
st.markdown(":red[Keine sinnvoll darstellbaren Koordinaten gefunden]")

View File

@@ -2057,7 +2057,7 @@ def maptiles_kachelkoordinaten(eingabetext):
try:
la = float(text[0])
lo = float(text[1])
if not la < -85.05113 and not la > 85.05113 and not lo < -180 and not lo > 180:
if not la < -83.0 and not la > 83.0 and not lo < -180 and not lo > 180:
x, y = helper.dec_to_maptiles(la, lo, zoom)
ausgabetext += f"|{zoom:>2}|{x:<10}|{y}|\n"
except ValueError:
@@ -2065,17 +2065,18 @@ def maptiles_kachelkoordinaten(eingabetext):
return ausgabetext, None
elif len(text) == 2:
ausgabetext = ":violet[Maptiles->DEG,DEC] \n|:blue[Zoom]|:blue[DEG]|:blue[DEC]|\n|-|-|-|\n"
lat_list, lon_list = [], []
lat_list, lon_list, label_list = [], [], []
for zoom in range(2, 26):
try:
la, lo = helper.maptiles_to_dec(int(text[0]), int(text[1]), zoom)
if not la < -85.05113 and not la > 85.05113 and not lo < -180 and not lo > 180:
if not la < -83.0 and not la > 83.0 and not lo < -180 and not lo > 180:
ausgabetext += f"|{zoom:>2}|{helper.dec_to_deg(la, lo):<23}|{round(la, 5)} {round(lo, 5)}| \n"
lat_list.append(la)
lon_list.append(lo)
label_list.append(zoom)
except OverflowError:
pass
return ausgabetext, pd.DataFrame({'lat': lat_list, 'lon': lon_list})
return ausgabetext, pd.DataFrame({'lat': lat_list, 'lon': lon_list, 'label': label_list})
else:
return ":red[Zahlen konnten nicht ermittelt werden!]", None

Binary file not shown.

Before

Width:  |  Height:  |  Size: 159 KiB

View File

@@ -1,47 +0,0 @@
<!--
Copyright (c) Streamlit Inc. (2018-2022) Snowflake Inc. (2022-2025)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, shrink-to-fit=no"
/>
<link rel="shortcut icon" href="./favicon.ico" />
<link
rel="preload"
href="./static/media/SourceSansVF-Upright.ttf.BsWL4Kly.woff2"
as="font"
type="font/woff2"
crossorigin
/>
<title>tebarius Mysteryhelfer (web)</title>
<!-- initialize window.prerenderReady to false and then set to true in React app when app is ready for indexing -->
<script>
window.prerenderReady = false
</script>
<script type="module" crossorigin src="./static/js/index.BTGIlECR.js"></script>
<link rel="stylesheet" crossorigin href="./static/css/index.CJVRHjQZ.css">
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
</body>
</html>

Binary file not shown.