{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "dab92bca-c0af-40d4-bd66-316bb3e8318a", "metadata": {}, "outputs": [], "source": [ "import requests\n", "import geopandas as gpd\n", "import pandas as pd\n", "import numpy as np\n", "# to display the return json\n", "import json\n", "from IPython.display import display, JSON, GeoJSON\n", "\n", "# import libs for plotting with lonboard\n", "from lonboard import Map, PolygonLayer\n", "import ipywidgets as widgets\n", "import matplotlib.pyplot as plt\n", "import matplotlib.ticker as mticker\n", "import matplotlib as mpl\n", "\n", "# function to create the color bar for plotting with lonboard\n", "def create_colorbar(data, cmap_name, legend, vcenter=None):\n", " fig, ax = plt.subplots(figsize=(8, 0.8))\n", " center = (np.nanmax(data)-np.nanmin(data))/2 if (vcenter is None) else vcenter\n", " cbar = plt.colorbar(\n", " plt.cm.ScalarMappable(norm=mpl.colors.TwoSlopeNorm(vmin=np.nanmin(data), vmax=np.nanmax(data), vcenter=center), cmap=cmap_name),\n", " cax=ax,\n", " orientation='horizontal'\n", " )\n", " tick_values = np.linspace(np.nanmin(data), np.nanmax(data), num=10)\n", " cbar.set_ticks(tick_values)\n", " #cbar.ax.xaxis.set_major_formatter(mticker.FuncFormatter(thousands_formatter))\n", " cbar.ax.tick_params(labelsize=8)\n", " cbar.set_label(legend, fontsize=10)\n", " plt.tight_layout()\n", " plt.show()" ] }, { "cell_type": "markdown", "id": "94d1fcc0-9a5e-413d-b907-27ccccee7962", "metadata": {}, "source": [ "# A demo notebook for pydggsapi\n", "\n", "## Description\n", "Purpose: To discover DGGS collections using pydggsapi. In this example, we focus on 3 DGGS collections in IGEO7 DGGRS located in Estonia near Elva. They are : \n", "- DEM\n", "- Slope\n", "- TWI\n", "\n", "All collections are produced from a clipped Geotiff near Elva with 10M spatial resolution. The clipped region was converted to DGGRS IGEO7 at refinement 14 using the nearest centroid regridding method. Then, data were aggregated to the refinement level 1 using the mean (skip nan), with the 1-to-7 hierarchical structure.\n", "\n", "Those collections are hosted in the pydggsapi instance: https://dggs.geokuup.ee/dggs-api/. \n", "\n", "The spatial extent of the region in wgs84 is : [[26.2718, 58.2267, 26.5815, 58.3295]]" ] }, { "cell_type": "code", "execution_count": 3, "id": "4fa265da-bbac-4e28-a632-ba42b0d89c6f", "metadata": {}, "outputs": [], "source": [ "# define the root URL of the API endpoint \n", "dggs_api_root = \"https://dggs.geokuup.ee/dggs-api\"" ] }, { "cell_type": "markdown", "id": "04c97e04-10cb-471f-b4c8-a9f46cad9de4", "metadata": {}, "source": [ "## Where is it? \n", "The first step to discover collections published by the instance is to answer the question of \"Where is it?\" The answer is provided by the zone-query endpoint. The query accepts the following query parameters:\n", "\n", "### Zone-query endpoint details\n", "- `bbox`: Bounding box of the query. The bounding box is provided as four coordinates, in the order of minx, miny, maxx and maxy\n", "\n", "- `zone-level`: For specifying a level at which to return a list of DGGRS zones using a zone_level query parameter.\n", "\n", "- `compact-zone`: For specifying whether to retrieve a list of DGGRS zones using a compact_zones query parameter.\n", "\n", "- `parent-zone`: For specifying a parent zone within which to restrict zone listing using a parent_zone query parameter.\n", "\n", "- `geometry`: Specify the return geometry (zone-centroid or zone-region), defaults to zone-region\n", "\n", "- `filter`: A CQL2 filter string\n", "\n", "- `datetime`: Specify the datetime interval\n", "\n", "Users can specify the return type in the HTTP header or using the format query string. The zone query supports the following return types, defaults to JSON:\n", "\n", "- `?f=json`: or setting application/json in the HTTP header, it returns the zones list in DGGS-JSON schema.\n", "\n", "- `?f=geojson`: or setting application/geo+json in the HTTP header, it returns the zones list in geojson with geometries supplied.\n", "\n", "\n", "It provides translation service between coordinate and DGGS zones ID. It returns a list of zones that consists of data from published collections.\n", "\n", "### Execute the Zone-query " ] }, { "cell_type": "code", "execution_count": 3, "id": "7d5b752d-db6d-4c4c-9926-f8defd7b7f81", "metadata": {}, "outputs": [ { "data": { "application/json": { "returnedAreaMetersSquare": 495484142.40000004, "zones": [ "000102244", "000102246", "000102630", "000102631", "000102633", "000102634", "000102635", "000102636" ] }, "text/plain": [ "" ] }, "execution_count": 3, "metadata": { "application/json": { "expanded": false, "root": "root" } }, "output_type": "execute_result" } ], "source": [ "# To query the zones list of a bounding box at refinement level 7 (~62 km^2 per zone) with compact zone set to off \n", "bbox = \"26.2718,58.2267,26.5815,58.3295\"\n", "zone_level=7\n", "compact_zone=False\n", "# send the query , we are instereted in DGGRS IGEO7, so specify it in the path parameter\n", "zone_query_return = requests.get(dggs_api_root+'/dggs/igeo7/zones', params={'bbox': bbox, \n", " 'zone-level': zone_level,\n", " 'compact-zone': compact_zone})\n", "if (zone_query_return.status_code != 204):\n", " zone_query_return = zone_query_return.json()\n", " display(JSON(zone_query_return))\n", "else:\n", " print(\"empty return\")" ] }, { "cell_type": "markdown", "id": "ff5f3472-9229-48d1-899f-c2412385d555", "metadata": {}, "source": [ "### Returns from the Zone-query\n", "The Above returns 8 zones ID of IGEO7 at refinement level 7. It means that those zones consists of data from collections published in this pydggapi instance. Those zones ID are used to retrieval the actual data in the next step." ] }, { "cell_type": "markdown", "id": "fc8807ba-26c2-479b-9432-7dc9c4ed9bc8", "metadata": {}, "source": [ "## What is here? \n", "After knowing where to look, it's time to answer the question \"What is here?\" to get the actual data from collections using the zone-data retrieval endpoint. \n", "\n", "### Zone-data retrieval endpoint details\n", "The query accepts the following query parameters:\n", "\n", "- `zone-depth`: For specifying a level at which to return a list of DGGRS zones using a zone_level query parameter.\n", "\n", "- `geometry`: Specify the return geometry (zone-centroid or zone-region), defaults to zone-region\n", "\n", "- `filter`: A CQL2 filter string\n", "\n", "- `datetime`: Specify the datetime interval\n", "\n", "Users can specify the return type in the HTTP header or using the format query string. The zone query supports the following return types, defaults to JSON:\n", "\n", "- `?f=json`: or setting application/json in the HTTP header (default)\n", "\n", "- `?f=ubjson`: or application/ubjson in the HTTP header\n", "\n", "- `?f=geojson`: or application/geo+json in the HTTP header\n", "\n", "- `?f=zarr`: or application/zarr+zip in the HTTP header\n", "\n", "\n", "### Execute the Zone-data retrieval\n", "\n", "#### The simplest query with only the `zone ID`" ] }, { "cell_type": "code", "execution_count": 4, "id": "3c21c11e-4b30-49da-82a6-e994da0e99fd", "metadata": {}, "outputs": [ { "data": { "application/json": { "$schema": "https://schemas.opengis.net/ogcapi/dggs/1.0/core/schemas/dggs-json/dggs-json.json", "depths": [ 0 ], "dggrs": "https://agile-giss.copernicus.org/articles/6/32/2025/", "schema": { "$id": null, "$schema": "https://json-schema.org/draft/2020-12/schema", "properties": { "Estonia_DEM_10M_Elva_igeo7_zarr.dem": { "format": "float32", "type": "number" }, "Estonia_Slope_10M_Elva_igeo7_zarr.slope": { "format": "float32", "type": "number" }, "Estonia_TWI_10M_Elva_igeo7_zarr.twi": { "format": "float32", "type": "number" } }, "title": "DGGS Zones Data Schema", "type": "object" }, "values": { "Estonia_DEM_10M_Elva_igeo7_zarr.dem": [ { "data": [ 73.05735778808594 ], "depth": 0, "shape": { "count": 1, "dimensions": {}, "subZones": 1 } } ], "Estonia_Slope_10M_Elva_igeo7_zarr.slope": [ { "data": [ 1.2631150484085083 ], "depth": 0, "shape": { "count": 1, "dimensions": {}, "subZones": 1 } } ], "Estonia_TWI_10M_Elva_igeo7_zarr.twi": [ { "data": [ 10.184617042541504 ], "depth": 0, "shape": { "count": 1, "dimensions": {}, "subZones": 1 } } ] }, "zoneId": "000102244" }, "text/plain": [ "" ] }, "metadata": { "application/json": { "expanded": false, "root": "root" } }, "output_type": "display_data" } ], "source": [ "zone_id = '000102244'\n", "# Zone depth = 0 means to return data at the same refinement level with the supplied zone ID, in this case, it is 7.\n", "zone_depth = 0\n", "zone_data_return = requests.get(dggs_api_root+f'/dggs/igeo7/zones/{zone_id}/data', params={'zone-depth': zone_depth})\n", "\n", "if (zone_data_return.status_code != 204):\n", " zone_data_return = zone_data_return.json()\n", " display(JSON(zone_data_return))\n", "else:\n", " print(\"empty return\")" ] }, { "cell_type": "markdown", "id": "bfb7ca0f-d8a2-408c-8c48-47c0f15ffeb1", "metadata": {}, "source": [ "From the above return, the `properties` attribute shows that there are 3 collections that contain data of the zone `000102244`. They are : \n", "- Estonia_TWI_10M_Elva_igeo7_zarr.twi\n", "- Estonia_Slope_10M_Elva_igeo7_zarr.slope\n", "- Estonia_DEM_10M_Elva_igeo7_zarr.dem\n", "\n", "The actual data from the 3 collections are located inside the `values` attribute. " ] }, { "cell_type": "markdown", "id": "698b8ce7-84d9-4546-81a8-3cfa5528dfae", "metadata": {}, "source": [ "#### Seamless integration with other applications using GeoJSON return\n", "pydggsapi supports returning results in GeoJSON format, which is widely used in the geoscience field, making it easy to integrate into any workflow that supports GeoJSON with minimal changes." ] }, { "cell_type": "code", "execution_count": 5, "id": "f74e05a1-cd7f-43b8-a421-9d3593356686", "metadata": { "scrolled": true }, "outputs": [ { "data": { "application/json": { "features": [ { "geometry": { "coordinates": [ [ [ 26.596394975217226, 58.35373403615539 ], [ 26.55415841674231, 58.31463644512665 ], [ 26.586644647852268, 58.26981106048124 ], [ 26.661221489372462, 58.26407041715636 ], [ 26.7035207426413, 58.30314100981717 ], [ 26.671180652526793, 58.347979244629585 ], [ 26.596394975217226, 58.35373403615539 ] ] ], "type": "Polygon" }, "id": 0, "properties": { "Estonia_DEM_10M_Elva_igeo7_zarr.dem": 73.05735778808594, "Estonia_Slope_10M_Elva_igeo7_zarr.slope": 1.2631150484085083, "Estonia_TWI_10M_Elva_igeo7_zarr.twi": 10.184617042541504, "depth": 0, "zoneId": "000102244" }, "type": "Feature" } ], "type": "FeatureCollection" }, "text/plain": [ "" ] }, "metadata": { "application/json": { "expanded": false, "root": "root" } }, "output_type": "display_data" } ], "source": [ "zone_id = '000102244'\n", "zone_depth = 0\n", "# Specify the return type using `f=geojson`\n", "zone_data_return = requests.get(dggs_api_root+f'/dggs/igeo7/zones/{zone_id}/data?f=geojson', params={'zone-depth': zone_depth})\n", "if (zone_data_return.status_code != 204):\n", " zone_data_return = zone_data_return.json()\n", " display(JSON(zone_data_return))\n", "else:\n", " print(\"empty return\")" ] }, { "cell_type": "markdown", "id": "735cf6db-223b-41fc-ac07-5a54513d9c74", "metadata": {}, "source": [ "From the GeoJSON above, it returns all data from the 3 collections, including the zone geometry. Since all collections are in DGGRS IGEO7, the polygons are hexagons. " ] }, { "cell_type": "markdown", "id": "3ce37fe4-8044-4d7a-8590-0c66cedd4685", "metadata": {}, "source": [ "#### Query data for all zones at a finer refinement level\n", "By specifying `zone_depth` with different values, the query can retrieve data from a finer refinement level. \n", "After getting all the GeoJSON returns of all zones, we can ingest that data into a geopandas dataframe using the `from_features` function of geopandas." ] }, { "cell_type": "code", "execution_count": 6, "id": "99a05279-ac28-44e9-a186-0d336c1db3ea", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Finished the zone-data query for zone: 000102244.\n", "Finished the zone-data query for zone: 000102246.\n", "Finished the zone-data query for zone: 000102630.\n", "Finished the zone-data query for zone: 000102631.\n", "Finished the zone-data query for zone: 000102633.\n", "Finished the zone-data query for zone: 000102634.\n", "Finished the zone-data query for zone: 000102635.\n", "Finished the zone-data query for zone: 000102636.\n", "CPU times: user 2.25 s, sys: 52.1 ms, total: 2.3 s\n", "Wall time: 14.2 s\n" ] }, { "data": { "text/html": [ "
Make this Notebook Trusted to load map: File -> Trust Notebook
" ], "text/plain": [ "" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "%%time\n", "# query data for all zones using the zones' ID returns from zone-query\n", "zone_id_list = zone_query_return['zones']\n", "# zone-depth = 3 means to return data at 3 finer levels relative to the refinement level of zone ID. \n", "# In this case, that is 7 + 3 = 10\n", "zone_depth = 3\n", "\n", "zone_data_df = []\n", "for zone_id in zone_id_list:\n", " zone_data_return = requests.get(dggs_api_root+f'/dggs/igeo7/zones/{zone_id}/data?f=geojson', \n", " params={'zone-depth': zone_depth})\n", " print(f'Finished the zone-data query for zone: {zone_id}.')\n", " if (zone_data_return.status_code != 204):\n", " zone_data_return = zone_data_return.json()\n", " # convert the geojson return to geopandas dataframe, then append it to zone_data_df\n", " zone_data_df.append(gpd.GeoDataFrame.from_features(zone_data_return))\n", " else:\n", " print(\"empty return\")\n", "\n", "# Concat all dataframes together\n", "zone_data_df = gpd.GeoDataFrame(pd.concat(zone_data_df, ignore_index=True)).set_crs('wgs84')\n", "zone_data_df = zone_data_df.drop_duplicates('zoneId')\n", "# Then visualise it using the explore function\n", "zone_data_df.explore(column='Estonia_TWI_10M_Elva_igeo7_zarr.twi')" ] }, { "cell_type": "markdown", "id": "7d54b842-00e8-456b-9b62-9363c9591b74", "metadata": {}, "source": [ "#### Query data at a finer refinement level and visualise it using lonboard\n", "\n", "Let's try a finer refinement level by setting the `zone-depth` parameter to 5; it will retrieve data at refinement level 12 (5 levels finer relative to the zone ID's refinement level). \n", "\n", "- it takes ~5mins to get around 50_000 zones data\n", "- follows from the above section, the data is converted into a geopandas dataframe\n", "- but this time, it is visualised using lonboard." ] }, { "cell_type": "code", "execution_count": 7, "id": "abc2c173-dd1b-4fef-822c-cc89719ae7b3", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Finished the zone-data query for zone: 000102244.\n", "Finished the zone-data query for zone: 000102246.\n", "Finished the zone-data query for zone: 000102630.\n", "Finished the zone-data query for zone: 000102631.\n", "Finished the zone-data query for zone: 000102633.\n", "Finished the zone-data query for zone: 000102634.\n", "Finished the zone-data query for zone: 000102635.\n", "Finished the zone-data query for zone: 000102636.\n", "CPU times: user 2.67 s, sys: 44.6 ms, total: 2.72 s\n", "Wall time: 5min 36s\n" ] } ], "source": [ "%%time\n", "# Using the return from zone-query\n", "zone_id_list = zone_query_return['zones']\n", "# Zone depth = 5 means that return data at 5 finer level relative to the refinement level of zone ID, in this case, \n", "# it is 7 + 5 = 12\n", "zone_depth = 5\n", "large_zone_data_df = []\n", "for zone_id in zone_id_list:\n", " zone_data_return = requests.get(dggs_api_root+f'/dggs/igeo7/zones/{zone_id}/data?f=geojson', params={'zone-depth': zone_depth}, timeout=None)\n", " if (zone_data_return.status_code != 204):\n", " print(f'Finished the zone-data query for zone: {zone_id}.')\n", " zone_data_return = zone_data_return.json()\n", " # convert the geojson return to geopandas dataframe, then append it to zone_data_df\n", " large_zone_data_df.append(gpd.GeoDataFrame.from_features(zone_data_return))\n", " else:\n", " print(\"empty return\")\n", "# Then concat all dataframes together\n", "large_zone_data_df = gpd.GeoDataFrame(pd.concat(large_zone_data_df, ignore_index=True)).set_crs('wgs84')\n", "large_zone_data_df = large_zone_data_df.drop_duplicates('zoneId')" ] }, { "cell_type": "code", "execution_count": 9, "id": "448e6681-1400-4505-b8b2-3d7f88b768de", "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "4e7629480c574c98b8b94cce2f59f763", "version_major": 2, "version_minor": 0 }, "text/plain": [ "VBox(children=(, Output()))" ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# plot the dataframe with lonboard \n", "# select the variable for plotting : \n", "# ['Estonia_DEM_10M_Elva_igeo7_zarr.dem' 'Estonia_Slope_10M_Elva_igeo7_zarr.slope', 'Estonia_TWI_10M_Elva_igeo7_zarr.twi']\n", "variable = 'Estonia_DEM_10M_Elva_igeo7_zarr.dem'\n", "variable_values = large_zone_data_df[variable]\n", "#create a colour map that is identical to the one that used in create_colorbar\n", "center = np.nanmin(variable_values)+((np.nanmax(variable_values)- np.nanmin(variable_values))/2)\n", "cm = plt.cm.ScalarMappable(norm=mpl.colors.TwoSlopeNorm(vmin=np.nanmin(variable_values),\n", " vmax=np.nanmax(variable_values),\n", " vcenter=center), cmap='viridis') \n", "layer = PolygonLayer.from_geopandas(\n", " large_zone_data_df,\n", " line_width_min_pixels=0.2, \n", " get_fill_color= cm.to_rgba(variable_values, bytes=True, alpha=0.4)\n", ")\n", "m = Map(layer)\n", "colorbar_output = widgets.Output()\n", "with colorbar_output:\n", " create_colorbar(variable_values, 'viridis', variable, center)\n", "widgets.VBox([m,colorbar_output])" ] }, { "cell_type": "markdown", "id": "40b6af5d-1de8-49ea-a48e-f375ffbfae3a", "metadata": {}, "source": [ "#### Data filtering using the `filter` parameter\n", "\n", "During research, a user may want to focus on a specific subset of the data, which can be achieved by using the `filter` parameter. The `filter` parameter accepts a CQL query string that applies to collections containing the variables in the query string.\n", "\n", "In the following example, the use of the `filter` parameter is demonstrated to return data with `(slope > 3)`" ] }, { "cell_type": "code", "execution_count": 12, "id": "cf322422-2df2-4752-8494-6264043286ba", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Finished the zone-data query for zone: 000102244.\n", "Finished the zone-data query for zone: 000102246.\n", "Finished the zone-data query for zone: 000102630.\n", "Finished the zone-data query for zone: 000102631.\n", "Finished the zone-data query for zone: 000102633.\n", "Finished the zone-data query for zone: 000102634.\n", "Finished the zone-data query for zone: 000102635.\n", "Finished the zone-data query for zone: 000102636.\n", "CPU times: user 771 ms, sys: 32.3 ms, total: 803 ms\n", "Wall time: 7min 17s\n" ] } ], "source": [ "%%time\n", "# Using the return from zone-query\n", "zone_id_list = zone_query_return['zones']\n", "zone_depth = 5\n", "# In this example, only returns zones that with slope > 3\n", "cql_filter = '(slope > 3)'\n", "\n", "filtered_large_zone_data_df = []\n", "for zone_id in zone_id_list:\n", " zone_data_return = requests.get(dggs_api_root + f'/dggs/igeo7/zones/{zone_id}/data?f=geojson', \n", " params={'zone-depth': zone_depth, \n", " 'filter': cql_filter})\n", " if (zone_data_return.status_code != 204):\n", " print(f'Finished the zone-data query for zone: {zone_id}.')\n", " zone_data_return = zone_data_return.json()\n", " # convert the geojson return to geopandas dataframe, then append it to zone_data_df\n", " filtered_large_zone_data_df.append(gpd.GeoDataFrame.from_features(zone_data_return))\n", " else:\n", " print(\"empty return\")\n", " \n", "# Then concat all dataframes together\n", "filtered_large_zone_data_df = gpd.GeoDataFrame(pd.concat(filtered_large_zone_data_df, ignore_index=True)).set_crs('wgs84')\n", "filtered_large_zone_data_df = filtered_large_zone_data_df.drop_duplicates('zoneId')" ] }, { "cell_type": "code", "execution_count": 13, "id": "042fad98-e1c9-451a-96ff-5c2fb467fbfe", "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "15274e007c4d49c09022a9e16d039a50", "version_major": 2, "version_minor": 0 }, "text/plain": [ "VBox(children=(, Output()))" ] }, "execution_count": 13, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# plot the dataframe with lonboard \n", "variable = 'Estonia_Slope_10M_Elva_igeo7_zarr.slope'\n", "variable_values = filtered_large_zone_data_df[variable]\n", "#create a colour map that is identical to the one that used in create_colorbar\n", "center = np.nanmin(variable_values)+((np.nanmax(variable_values)- np.nanmin(variable_values))/2)\n", "cm = plt.cm.ScalarMappable(norm=mpl.colors.TwoSlopeNorm(vmin=np.nanmin(variable_values),\n", " vmax=np.nanmax(variable_values),\n", " vcenter=center), cmap='viridis') \n", "layer = PolygonLayer.from_geopandas(\n", " filtered_large_zone_data_df,\n", " line_width_min_pixels=0.2, # minimum width when zoomed out\n", " get_fill_color= cm.to_rgba(variable_values, bytes=True, alpha=0.4)\n", ")\n", "m = Map(layer)\n", "colorbar_output = widgets.Output()\n", "with colorbar_output:\n", " create_colorbar(variable_values, 'viridis', variable, center)\n", "widgets.VBox([m,colorbar_output])" ] }, { "cell_type": "markdown", "id": "2c9e2dfb-9155-413f-8a19-84483b7b4938", "metadata": {}, "source": [ "## Using MVT tiles to query collection \n", "In this example, we use the ipyleaflet library to display the MVT tiles published by pydggsapi for each collection.\n", "\n", "The MVT tiles URL can be used in any other GIS desktop application, such as QGIS. " ] }, { "cell_type": "code", "execution_count": null, "id": "ebc76a0b-aaf3-4661-bf73-1cabad613278", "metadata": {}, "outputs": [], "source": [ "# Install ipyleaflet\n", "#!pip install ipyleaflet\n", "#!jupyter nbextension enable --py --sys-prefix ipyleaflet" ] }, { "cell_type": "code", "execution_count": 15, "id": "940dce11-4440-4849-a445-0633d94b6acf", "metadata": {}, "outputs": [], "source": [ "from ipyleaflet import Map, VectorTileLayer" ] }, { "cell_type": "code", "execution_count": 18, "id": "7ca8a2ac-36d1-442a-a0f1-fa54a9fab53f", "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "0a51a7bc92cc4c6482f9e76240e8108e", "version_major": 2, "version_minor": 0 }, "text/plain": [ "Map(center=[58.378, 26.729], controls=(ZoomControl(options=['position', 'zoom_in_text', 'zoom_in_title', 'zoom…" ] }, "execution_count": 18, "metadata": {}, "output_type": "execute_result" } ], "source": [ "#Try out other collections\n", "#https://dggs.geokuup.ee/tiles-api/Estonia_Slope_10M_Elva_igeo7_zarr/{z}/{x}/{y}\n", "#https://dggs.geokuup.ee/tiles-api/Estonia_DEM_10M_Elva_igeo7_zarr/{z}/{x}/{y}\n", "#https://dggs.geokuup.ee/tiles-api/Estonia_TWI_10M_Elva_igeo7_zarr/{z}/{x}/{y}\n", "planet_tiles_url=(\"https://dggs.geokuup.ee/tiles-api/Estonia_Slope_10M_Elva_igeo7_zarr/{z}/{x}/{y}?relative_depth=1\")\n", "\n", "tile_layer=VectorTileLayer(url=planet_tiles_url)\n", "\n", "m = Map(\n", " default_tiles=tile_layer,\n", " zoom=10,\n", " center=[58.3780,26.7290],\n", " scroll_wheel_zoom=True)\n", "\n", "m.add_layer(tile_layer)\n", "m" ] }, { "cell_type": "code", "execution_count": null, "id": "1ff84439-69da-4291-a40d-8ff9ee3349e0", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "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.12.0" } }, "nbformat": 4, "nbformat_minor": 5 }