{ "cells": [ { "cell_type": "markdown", "id": "66b2deb3-f13a-411a-af98-e17b85ac53ab", "metadata": {}, "source": [ "# Example of Geocoding of Counties: United States" ] }, { "cell_type": "code", "execution_count": 1, "id": "a34636a0", "metadata": { "execution": { "iopub.execute_input": "2026-01-27T17:10:34.887454Z", "iopub.status.busy": "2026-01-27T17:10:34.887362Z", "iopub.status.idle": "2026-01-27T17:10:34.932763Z", "shell.execute_reply": "2026-01-27T17:10:34.932300Z" } }, "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": "941870ce-fbf6-47f0-b3c7-05bc551141d2", "metadata": { "execution": { "iopub.execute_input": "2026-01-27T17:10:34.933947Z", "iopub.status.busy": "2026-01-27T17:10:34.933872Z", "iopub.status.idle": "2026-01-27T17:10:34.935481Z", "shell.execute_reply": "2026-01-27T17:10:34.935276Z" } }, "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:10:34.936367Z", "iopub.status.busy": "2026-01-27T17:10:34.936296Z", "iopub.status.idle": "2026-01-27T17:10:37.342403Z", "shell.execute_reply": "2026-01-27T17:10:37.341788Z" } }, "outputs": [ { "data": { "text/html": [ "
\n", " " ], "text/plain": [ "" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "gdf = geocode_counties().scope('US-48').inc_res().get_boundaries()\n", "\n", "ggplot() + \\\n", " geom_map(data=gdf, color='white', fill='lightseagreen', \\\n", " tooltips=layer_tooltips().line('@{found name}')) + \\\n", " ggsize(800, 600) + ggtitle('US Counties') + \\\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 }