Add gdf example

course
anitagraser 2021-05-13 10:44:46 +02:00
rodzic 8e6087807d
commit 6200c775bd
1 zmienionych plików z 56 dodań i 1 usunięć

Wyświetl plik

@ -68,6 +68,61 @@
"gdf.to_crs('epsg:4326')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Fetching elevation data for a whole GeoDataFrame"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from utils.dataaccess import get_gdf_from_wfs\n",
"citybike_gdf = get_gdf_from_wfs('CITYBIKEOGD')\n",
"citybike_gdf = citybike_gdf.to_crs('epsg:3857')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"def get_elevation_for_row(row):\n",
" return get_elevation(row.geometry)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"citybike_gdf['elevation'] = citybike_gdf.apply(get_elevation_for_row, axis=1)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"citybike_gdf = citybike_gdf.to_crs('epsg:4326')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"citybike_gdf.hvplot(c='elevation', geo=True, tiles='OSM', title='Citybike station elevation')"
]
},
{
"cell_type": "code",
"execution_count": null,
@ -92,7 +147,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.8"
"version": "3.7.10"
}
},
"nbformat": 4,