Skip to content

Commit 4b2c8f3

Browse files
committed
fix
1 parent 62b4788 commit 4b2c8f3

2 files changed

Lines changed: 13 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ All notable changes to the allocator project are documented in this file.
2222
- `setup.sh` script to download and preprocess OSM data for any region
2323
- `docker-compose.yml` for easy server management
2424

25+
**Visualization:**
26+
- Added `tiles` parameter to `plot_clusters_interactive()` and `plot_route_interactive()`
27+
- Default changed from OpenStreetMap to CartoDB positron (cleaner, less rate limiting)
28+
- Options: "CartoDB positron", "CartoDB dark_matter", "OpenStreetMap"
29+
2530
### Changed
2631

2732
- Legacy `method="google"` now emits `DeprecationWarning` recommending `google_routes`

allocator/viz/plotting.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@ def plot_clusters_interactive(
225225
centroids: np.ndarray | None = None,
226226
title: str = "Interactive Clustering Results",
227227
save_path: str | None = None,
228+
tiles: str = "CartoDB positron",
228229
) -> "folium.Map":
229230
"""
230231
Create an interactive map visualization of clustering results using folium.
@@ -235,6 +236,8 @@ def plot_clusters_interactive(
235236
centroids: Optional cluster centers as numpy array [k, 2]
236237
title: Map title (shown as map title)
237238
save_path: Path to save HTML file (optional)
239+
tiles: Map tile provider. Options: "CartoDB positron" (default, light),
240+
"CartoDB dark_matter" (dark), "OpenStreetMap"
238241
239242
Returns:
240243
Folium map object that can be displayed in Jupyter or saved to HTML
@@ -277,7 +280,7 @@ def plot_clusters_interactive(
277280
zoom_start = 8
278281

279282
# Create base map
280-
m = folium.Map(location=[center_lat, center_lon], zoom_start=zoom_start, tiles="OpenStreetMap")
283+
m = folium.Map(location=[center_lat, center_lon], zoom_start=zoom_start, tiles=tiles)
281284

282285
# Color palette for clusters
283286
n_clusters = len(np.unique(labels))
@@ -366,6 +369,7 @@ def plot_route_interactive(
366369
route_geometry: str | None = None,
367370
title: str = "Interactive Route",
368371
save_path: str | None = None,
372+
tiles: str = "CartoDB positron",
369373
) -> "folium.Map":
370374
"""
371375
Create an interactive map visualization of TSP/routing results using folium.
@@ -376,6 +380,8 @@ def plot_route_interactive(
376380
route_geometry: Optional encoded polyline string from routing API (OSRM/Google)
377381
title: Map title
378382
save_path: Path to save HTML file (optional)
383+
tiles: Map tile provider. Options: "CartoDB positron" (default, light),
384+
"CartoDB dark_matter" (dark), "OpenStreetMap"
379385
380386
Returns:
381387
Folium map object that can be displayed in Jupyter or saved to HTML
@@ -411,7 +417,7 @@ def plot_route_interactive(
411417
zoom_start = 8
412418

413419
# Create base map
414-
m = folium.Map(location=[center_lat, center_lon], zoom_start=zoom_start, tiles="OpenStreetMap")
420+
m = folium.Map(location=[center_lat, center_lon], zoom_start=zoom_start, tiles=tiles)
415421

416422
# Add route line
417423
if route_geometry and HAS_POLYLINE:

0 commit comments

Comments
 (0)