diff --git a/.gitignore b/.gitignore index 6ccd6de..989021f 100644 --- a/.gitignore +++ b/.gitignore @@ -139,3 +139,5 @@ notebooks/ZAEHLSPRGR0OGD.json notebooks/lumesakt.csv *.zip *.gpx + +/notebooks/data \ No newline at end of file diff --git a/notebooks/img/architecture.jpg b/notebooks/img/architecture.jpg new file mode 100644 index 0000000..1ba9411 Binary files /dev/null and b/notebooks/img/architecture.jpg differ diff --git a/notebooks/img/datascience.png b/notebooks/img/datascience.png new file mode 100644 index 0000000..f2d5747 Binary files /dev/null and b/notebooks/img/datascience.png differ diff --git a/notebooks/img/leaflet.PNG b/notebooks/img/leaflet.PNG new file mode 100644 index 0000000..4e350a7 Binary files /dev/null and b/notebooks/img/leaflet.PNG differ diff --git a/notebooks/img/osm-qgis.PNG b/notebooks/img/osm-qgis.PNG new file mode 100644 index 0000000..76ff020 Binary files /dev/null and b/notebooks/img/osm-qgis.PNG differ diff --git a/notebooks/img/wfs-qgis.PNG b/notebooks/img/wfs-qgis.PNG new file mode 100644 index 0000000..3ae8176 Binary files /dev/null and b/notebooks/img/wfs-qgis.PNG differ diff --git a/notebooks/img/wms-qgis.PNG b/notebooks/img/wms-qgis.PNG new file mode 100644 index 0000000..f5233bd Binary files /dev/null and b/notebooks/img/wms-qgis.PNG differ diff --git a/notebooks/webmapping.ipynb b/notebooks/webmapping.ipynb new file mode 100644 index 0000000..56271a4 --- /dev/null +++ b/notebooks/webmapping.ipynb @@ -0,0 +1,296 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Welcome to the Mobile & Web Mapping Lab - Session 2!" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Recap of session 1\n", + "\n", + "### Data collection & presentation as essential parts of geographic data science\n", + "\n", + "![](./img/datascience.png)\n", + "\n", + "*Figure: Data science workflow (Graser & Dragaschnig 2020).*\n", + "\n", + "### Intro to webmapping \n", + "\n", + "\n", + "![](./img/architecture.jpg)\n", + "\n", + "*Figure: Typical web mapping architecture (Brovelli et al. 2013).*\n", + "\n", + "
\n", + "
\n", + "
\n", + "\n", + "
" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Session 2: Webmapping services - more than just maps in a browser\n", + "\n", + "**Today's goals**\n", + "\n", + "* Understanding different types of web map service standards\n", + "* Exploring other useful non-standard service examples\n", + "\n", + "
\n", + "
\n", + "
\n", + " \n", + "### 1. Tiles / basemaps\n", + "\n", + "**Use case:** Map background / geographic context\n", + "\n", + "**Standard:** Web Map Tile Services (WMTS) / XYZ Tiles\n", + "\n", + "\n", + "
\n", + "
\n", + "
\n", + "\n", + "Basemap tiles are everywhere ...\n", + "\n", + "#### In desktop GIS, e.g. QGIS\n", + "\n", + "![](./img/osm-qgis.png)\n", + "\n", + "*Figure: OSM Tiles in QGIS*\n", + "\n", + "
\n", + "
\n", + "
\n", + "\n", + "#### In web maps, e.g. Leaflet\n", + "\n", + "![](./img/leaflet.png)\n", + "\n", + "*Figure: OSM Tiles in Leaflet*\n", + "\n", + "
\n", + "
\n", + "
\n", + "\n", + "#### In notebooks, e.g. Geoviews & Bokeh" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import holoviews as hv\n", + "import geoviews as gv\n", + "gv.extension('bokeh')\n", + "\n", + "basemap = hv.element.tiles.OSM().opts(width=450, height=450)\n", + "basemap" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Documentation: http://geoviews.org/user_guide/Working_with_Bokeh.html\n", + "\n", + "
\n", + "
\n", + "
" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### 2. Raster maps\n", + "\n", + "**Use case:** Cartographic products (e.g. hillshades, topographic maps), map overlays ...\n", + "\n", + "**Standard:** Web Map Services (WMS) \n", + "\n", + "
\n", + "
\n", + "
\n", + "\n", + "#### In desktop GIS, e.g. QGIS\n", + "\n", + "![](./img/wms-qgis.png)\n", + "\n", + "*Figure: WMS layers in QGIS*\n", + "\n", + "
\n", + "
\n", + "
\n", + "\n", + "#### In notebooks, e.g. Geoviews & Bokeh" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "url = \"\"\"\n", + "http://data.wien.gv.at/daten/geo?\n", + "&service=WMS\n", + "&request=GetMap\n", + "&layers=ogdwien:DONAUINSPKTOGD\n", + "&styles=\n", + "&format=image/png\n", + "&transparent=true\n", + "&version=1.3.0\n", + "&width=256\n", + "&height=256\n", + "&crs=EPSG:3857\n", + "&bbox={XMIN},{YMIN},{XMAX},{YMAX}\n", + "\"\"\"\n", + "\n", + "basemap = hv.element.tiles.OSM().opts(width=450, height=450)\n", + "map_with_overlay = basemap * hv.Tiles(url, extents=(1825290,6144246,1827693,6146435))\n", + "map_with_overlay" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "url2 = \"\"\"\n", + "http://data.wien.gv.at/daten/geo?\n", + "&service=WMS\n", + "&request=GetMap\n", + "&layers=ogdwien:DONAUKILOMETEROGD\n", + "&styles=\n", + "&format=image/png\n", + "&transparent=true\n", + "&version=1.3.0\n", + "&width=256\n", + "&height=256\n", + "&crs=EPSG:3857\n", + "&bbox={XMIN},{YMIN},{XMAX},{YMAX}\n", + "\"\"\"\n", + "\n", + "map_with_overlay * hv.Tiles(url2, extents=(1825290,6144246,1827693,6146435))" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Source: https://github.com/holoviz/geoviews/issues/481\n", + "\n", + "
\n", + "
\n", + "
" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### 3. Vector data\n", + "\n", + "**Use case:** Access to geometry and attribute data\n", + "\n", + "**Standard:** Web Feature Services (WFS) \n", + "\n", + "
\n", + "
\n", + "
\n", + "\n", + "#### In desktop GIS, e.g. QGIS\n", + "\n", + "![](./img/wfs-qgis.png)\n", + "\n", + "*Figure: WFS layer in QGIS*\n", + "\n", + "
\n", + "
\n", + "
\n", + "\n", + "#### In notebooks, e.g. Geoviews & Bokeh" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import geopandas as gpd\n", + "from urllib.request import urlretrieve\n", + "import hvplot.pandas\n", + "\n", + "layer = 'CITYBIKEOGD'\n", + "file = f'data/{layer}.json'\n", + "url = f\"https://data.wien.gv.at/daten/geo?service=WFS&request=GetFeature&version=1.1.0&typeName=ogdwien:{layer}&srsName=EPSG:4326&outputFormat=json\"\n", + "urlretrieve(url, file)\n", + "gdf = gpd.read_file(file)\n", + "gdf" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "gdf.hvplot(geo=True, tiles='OSM', hover_cols=['STATION']).opts(active_tools=['wheel_zoom'])" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### 4. Other non-standard service examples\n", + "\n", + "1. [Geocoding addresses with Nominatim](geocoding.ipynb)\n", + "1. [Getting elevation information](elevation.ipynb)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## References\n", + "\n", + "* Brovelli, M., Minghini, M., & Zamboni, G. (2013). Web–based Participatory GIS with data collection on the field–A prototype architecture. In Free and Open Source Software for Geospatial (FOSS4G) Conference Proceedings (Vol. 13, No. 1, p. 5).\n", + "* Graser, A. & Dragaschnig, M. (2020). Open Geospatial Tools for Movement Data Exploration. KN ‒ Journal of Cartography and Geographic Information, 70(1), 3-10. doi:10.1007/s42489-020-00039-y." + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.7.10" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +}