Fix automated relay map generation (#12)

This commit is contained in:
a1denvalu3
2026-07-24 13:48:08 +02:00
committed by GitHub
parent 107152e3a7
commit 67b04d023c
2 changed files with 33 additions and 51 deletions
+4 -2
View File
@@ -31,11 +31,13 @@ jobs:
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install matplotlib pandas numpy folium scipy
# Matplotlib 3.11 raises a LinearRing error with Cartopy 0.25.0.
# Keep this at the last version known to render all three maps.
pip install matplotlib==3.10.9 pandas numpy folium scipy
# Install cartopy and its dependencies
sudo apt-get update
sudo apt-get install -y libproj-dev proj-bin proj-data libgeos-dev
pip install cartopy
pip install cartopy==0.25.0
- name: Generate relay maps
run: |
+2 -22
View File
@@ -199,7 +199,6 @@ def main():
# Ensure the assets directory exists
os.makedirs('assets', exist_ok=True)
try:
# Read the relay data
df = pd.read_csv('nostr_relays.csv')
@@ -210,43 +209,24 @@ def main():
df = df[(df['Latitude'] >= -90) & (df['Latitude'] <= 90) &
(df['Longitude'] >= -180) & (df['Longitude'] <= 180)]
# Generate maps
# 1. Interactive HTML map
# Generate maps. Any failure must propagate so CI cannot commit a partial
# update while reporting a successful workflow.
relay_count_interactive = create_interactive_map(
df,
'assets/relay_locations_interactive.html'
)
# 2. Static PNG map
try:
relay_count_static = create_static_map(
df,
'assets/relay_locations_static.png'
)
except Exception as e:
print(f"Error creating static map: {e}")
relay_count_static = 0
# 3. Heatmap
try:
from scipy.ndimage import gaussian_filter
relay_count_heatmap = create_heatmap(
df,
'assets/relay_locations_heatmap.png'
)
except ImportError:
print("Could not create heatmap: scipy not installed")
relay_count_heatmap = 0
# Print summary
print(f"Generated interactive map with {relay_count_interactive} relays")
if relay_count_static > 0:
print(f"Generated static map with {relay_count_static} relays")
if relay_count_heatmap > 0:
print(f"Generated heatmap with {relay_count_heatmap} relays")
except Exception as e:
print(f"Error generating relay maps: {e}")
if __name__ == "__main__":
main()