Spaces:
Runtime error
Runtime error
Merge pull request #111 from TomorrowsCities/revert-110-revert-108-ui_power_icons
Browse files
tomorrowcities/pages/engine.py
CHANGED
|
@@ -10,7 +10,7 @@ import geopandas as gpd
|
|
| 10 |
from typing import Callable, List, Optional, Union, cast, Tuple
|
| 11 |
from pathlib import Path
|
| 12 |
import ipyleaflet
|
| 13 |
-
from ipyleaflet import AwesomeIcon, CircleMarker, Marker
|
| 14 |
import numpy as np
|
| 15 |
import rasterio
|
| 16 |
from rasterio.warp import calculate_default_transform, reproject, Resampling
|
|
@@ -561,15 +561,18 @@ def create_map_layer(df, name):
|
|
| 561 |
for index, node in df.iterrows():
|
| 562 |
x = node.geometry.x
|
| 563 |
y = node.geometry.y
|
| 564 |
-
marker_color = ds_to_color_approx[node['ds']]
|
| 565 |
-
icon_name = 'fa-industry' if node['pwr_plant'] == 1 else 'bolt'
|
| 566 |
-
icon_color = 'black'
|
| 567 |
-
marker = Marker(icon=AwesomeIcon(
|
| 568 |
-
name=icon_name,
|
| 569 |
-
marker_color=marker_color,
|
| 570 |
-
icon_color=icon_color,
|
| 571 |
-
spin=False
|
| 572 |
-
),location=(y,x),title=f'{node["node_id"]}',draggable=False)
|
|
|
|
|
|
|
|
|
|
| 573 |
|
| 574 |
markers.append(marker)
|
| 575 |
map_layer= ipyleaflet.MarkerCluster(markers=markers, name = name,
|
|
|
|
| 10 |
from typing import Callable, List, Optional, Union, cast, Tuple
|
| 11 |
from pathlib import Path
|
| 12 |
import ipyleaflet
|
| 13 |
+
from ipyleaflet import AwesomeIcon, CircleMarker, Marker, Icon
|
| 14 |
import numpy as np
|
| 15 |
import rasterio
|
| 16 |
from rasterio.warp import calculate_default_transform, reproject, Resampling
|
|
|
|
| 561 |
for index, node in df.iterrows():
|
| 562 |
x = node.geometry.x
|
| 563 |
y = node.geometry.y
|
| 564 |
+
# marker_color = ds_to_color_approx[node['ds']]
|
| 565 |
+
# icon_name = 'fa-industry' if node['pwr_plant'] == 1 else 'bolt'
|
| 566 |
+
# icon_color = 'black'
|
| 567 |
+
# marker = Marker(icon=AwesomeIcon(
|
| 568 |
+
# name=icon_name,
|
| 569 |
+
# marker_color=marker_color,
|
| 570 |
+
# icon_color=icon_color,
|
| 571 |
+
# spin=False
|
| 572 |
+
# ),location=(y,x),title=f'{node["node_id"]}',draggable=False)
|
| 573 |
+
icon_urls = '/static/public/icons/power_plant.png' if node['pwr_plant'] == 1 else '/static/public/icons/pole.png'
|
| 574 |
+
icons = Icon(icon_url=icon_urls, icon_size=[35,35]) if node['pwr_plant'] == 1 else Icon(icon_url=icon_urls, icon_size=[15,20])
|
| 575 |
+
marker = Marker(icon=icons, location=(y,x), title=f'{node["node_id"]}', draggable=False)
|
| 576 |
|
| 577 |
markers.append(marker)
|
| 578 |
map_layer= ipyleaflet.MarkerCluster(markers=markers, name = name,
|
tomorrowcities/public/icons/awesome_bolt.png
ADDED
|
|
tomorrowcities/public/icons/awesome_industry.png
ADDED
|
|
tomorrowcities/public/icons/pole.png
ADDED
|
|
tomorrowcities/public/icons/power_plant.png
ADDED
|
|