Data origins from https://opendata.swiss/en/dataset/elektrizitatsproduktionsanlagen
import pandas as pd
from ipyleaflet import Map, Marker, Popup
from ipywidgets import HTML
import geopandas as gpd
from shapely.geometry import Point
epp = pd.read_csv('../data/ch.bfe.elektrizitaetsproduktionsanlagen/ElectricityProductionPlant.csv', parse_dates=['BeginningOfOperation']).set_index('xtf_id')
epp
The x,y values in the dataset are based on the LV95 coordinate system. To render the data we first transform the data into WGS84 (latitute/longitude) coordinates
epp['geometry'] = epp.apply(lambda row: Point(row['_x'], row['_y']), axis=1)
gdf = gpd.GeoDataFrame(epp, geometry='geometry', crs='EPSG:2056')
gdf = gdf.to_crs(epsg=4326)
epp.head()
Sample from https://ipyleaflet.readthedocs.io/en/latest/
center = (46.030414,7.307939)
m = Map(center=center, zoom=15)
marker = Marker(location=center, draggable=True)
m.add_layer(marker);
display(m)
Create a 'Marker` for each nuclear power plant
Put the total power into the title
of the Marker
(Optional) Display Municipality in the popup
of the Marker
(Optional) Display the 100 largest water power plants with different colors (depending on the total power) as Circle
.
Hints
pd.apply()
with axis=1
to execute a function on each row of a DataFrame
row
by row.geometry.x
and row.geometry.y
, respectively