{
"cells": [
{
"cell_type": "markdown",
"id": "e3232e9a",
"metadata": {},
"source": [
"
\n",
"\n",
"# Electricity production plants - Geo Visualisation\n",
"\n",
"\n",
"Data origins from https://opendata.swiss/en/dataset/elektrizitatsproduktionsanlagen\n"
]
},
{
"cell_type": "markdown",
"id": "ea31f196",
"metadata": {},
"source": [
"## Loading data "
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "2d5f105d",
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"from ipyleaflet import Map, Marker, Popup\n",
"from ipywidgets import HTML\n",
"\n",
"import geopandas as gpd\n",
"from shapely.geometry import Point\n",
"\n",
"epp = pd.read_csv('../../data-science-course/data/ch.bfe.elektrizitaetsproduktionsanlagen/ElectricityProductionPlant.csv', parse_dates=['BeginningOfOperation']).set_index('xtf_id')\n",
"epp"
]
},
{
"cell_type": "markdown",
"id": "8b232aa2",
"metadata": {},
"source": [
"## Coordinate System Transformation\n",
"\n",
"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"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "5cb1f9b7-fd22-462a-93b9-0b05e1b2df3c",
"metadata": {
"scrolled": true
},
"outputs": [],
"source": [
"epp['geometry'] = epp.apply(lambda row: Point(row['_x'], row['_y']), axis=1)\n",
"gdf = gpd.GeoDataFrame(epp, geometry='geometry', crs='EPSG:2056')\n",
"gdf = gdf.to_crs(epsg=4326)\n",
"epp.head()"
]
},
{
"cell_type": "markdown",
"id": "453bfb01",
"metadata": {},
"source": [
"# Sample IPLeaflet Map\n",
"\n",
"Sample from https://ipyleaflet.readthedocs.io/en/latest/"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "786fc58f",
"metadata": {},
"outputs": [],
"source": [
"center = (46.030414,7.307939)\n",
"\n",
"m = Map(center=center, zoom=15)\n",
"\n",
"marker = Marker(location=center, draggable=True)\n",
"\n",
"m.add_layer(marker);\n",
"\n",
"display(m)\n"
]
},
{
"cell_type": "markdown",
"id": "4f9d7655",
"metadata": {},
"source": [
"***\n",
" ## Put Power Plants on Map \n",
"\n",
"