Backup automatico script del 2026-09-19 07:00
This commit is contained in:
1 parent
35677497dc
commit
f347badf3b
4 files changed
+144
-39
No files matched your search
@@ -1793,10 +1793,11 @@ def generate_route_weather_map(df: pd.DataFrame, city1: str, city2: str, output_
|
||||
return False
|
||||
|
||||
try:
|
||||
import contextily as ctx
|
||||
from basemap_tiles import add_basemap
|
||||
CONTEXTILY_AVAILABLE = True
|
||||
except ImportError:
|
||||
CONTEXTILY_AVAILABLE = False
|
||||
add_basemap = None # type: ignore
|
||||
|
||||
if df.empty:
|
||||
return False
|
||||
@@ -1868,11 +1869,10 @@ def generate_route_weather_map(df: pd.DataFrame, city1: str, city2: str, output_
|
||||
ax.set_ylim(lat_min, lat_max)
|
||||
ax.set_aspect('equal', adjustable='box')
|
||||
|
||||
if CONTEXTILY_AVAILABLE:
|
||||
try:
|
||||
ctx.add_basemap(ax, crs='EPSG:4326', source=ctx.providers.OpenStreetMap.Mapnik,
|
||||
alpha=0.6, attribution_size=6)
|
||||
except:
|
||||
if CONTEXTILY_AVAILABLE and add_basemap is not None:
|
||||
# Non usare tile.openstreetmap.org: OSM blocca lo User-Agent di contextily
|
||||
# e restituisce tile "403 Access blocked" (vedi osm.wiki/Blocked).
|
||||
if not add_basemap(ax, alpha=0.85, attribution_size=6):
|
||||
CONTEXTILY_AVAILABLE = False
|
||||
|
||||
# Linea percorso
|
||||
|
||||