From d74d7f2cd03e5d875684b7c65b0680fd878dab2d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BF=AB=E4=B9=90=E7=9A=84=E8=80=81=E9=BC=A0=E5=AE=9D?=
=?UTF-8?q?=E5=AE=9D?= <42690037+LaoshuBaby@users.noreply.github.com>
Date: Thu, 29 Feb 2024 21:13:04 +0800
Subject: [PATCH] feat: change stylesheet
---
src/yuheng/plugin/viz_folium/__main__.py | 24 +++++++++++++++++++-----
1 file changed, 19 insertions(+), 5 deletions(-)
diff --git a/src/yuheng/plugin/viz_folium/__main__.py b/src/yuheng/plugin/viz_folium/__main__.py
index 4483b76..debaf89 100644
--- a/src/yuheng/plugin/viz_folium/__main__.py
+++ b/src/yuheng/plugin/viz_folium/__main__.py
@@ -81,6 +81,16 @@ def display(self, **kwargs) -> None:
self.add(v)
m = folium.Map(location=[0, 0], zoom_start=0)
+ # # You can replace with custom tiles
+ # m = folium.Map(
+ # tiles="https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}{r}.png",
+ # attr=" ".join(
+ # [
+ # f'© OpenStreetMap contributors',
+ # f'© CARTO',
+ # ]
+ # ),
+ # )
for element in self.element_list:
if isinstance(element, type(self.sample_node)):
@@ -111,15 +121,19 @@ def display(self, **kwargs) -> None:
if isinstance(element, type(self.sample_carto)):
print("Wow a hole map!")
for id, obj in element.node_dict.items():
- # print(f"world-node-{id}")
- folium.PolyLine(
- [(obj.lat, obj.lon), (obj.lat, obj.lon)]
+ # print(f"world-node-{id}") # debug
+ folium.ColorLine(
+ positions=[(obj.lat, obj.lon), (obj.lat, obj.lon)],
+ colors=[0.114514, 0.1919810],
+ colormap=["black", "black"],
+ weight=4,
).add_to(m)
for id, obj in element.way_dict.items():
- # print(f"world-way-{id}", len(obj.nds))
+ # print(f"world-way-{id}", len(obj.nds)) # debug
if len(obj.nds) >= 0:
folium.PolyLine(
- self.transform(self, obj, reference_carto=element)
+ self.transform(self, obj, reference_carto=element),
+ weight=2,
).add_to(m)
# gen html file or call webbrowser