{ "cells": [ { "cell_type": "markdown", "id": "092c036e-f926-45fc-8b19-e5c625310adc", "metadata": {}, "source": [ "# Example of Geocoding of Cities: Helsinki" ] }, { "cell_type": "code", "execution_count": 1, "id": "a34636a0", "metadata": { "execution": { "iopub.execute_input": "2026-01-27T17:11:06.547008Z", "iopub.status.busy": "2026-01-27T17:11:06.546932Z", "iopub.status.idle": "2026-01-27T17:11:06.589583Z", "shell.execute_reply": "2026-01-27T17:11:06.589247Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "The geodata is provided by © OpenStreetMap contributors and is made available here under the Open Database License (ODbL).\n" ] } ], "source": [ "from lets_plot.geo_data import *\n", "from lets_plot import *" ] }, { "cell_type": "code", "execution_count": 2, "id": "02af9b57-9727-4c48-aae3-64797a638774", "metadata": { "execution": { "iopub.execute_input": "2026-01-27T17:11:06.590776Z", "iopub.status.busy": "2026-01-27T17:11:06.590698Z", "iopub.status.idle": "2026-01-27T17:11:06.592510Z", "shell.execute_reply": "2026-01-27T17:11:06.592100Z" } }, "outputs": [ { "data": { "text/html": [ "\n", "
\n", " \n", " " ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "LetsPlot.setup_html()" ] }, { "cell_type": "code", "execution_count": 3, "id": "a9983319", "metadata": { "execution": { "iopub.execute_input": "2026-01-27T17:11:06.593740Z", "iopub.status.busy": "2026-01-27T17:11:06.593669Z", "iopub.status.idle": "2026-01-27T17:11:07.055244Z", "shell.execute_reply": "2026-01-27T17:11:07.054857Z" } }, "outputs": [ { "data": { "text/html": [ "
\n", " " ], "text/plain": [ "" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "city = 'Helsinki'\n", "gdf = geocode_cities(names=city).get_boundaries()\n", "\n", "ggplot() + \\\n", " geom_map(data=gdf, color='white', fill='deepskyblue') + \\\n", " ggsize(800, 600) + ggtitle(city) + \\\n", " theme_void()" ] } ], "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.10.13" } }, "nbformat": 4, "nbformat_minor": 5 }