Skip to content

Commit ba38d92

Browse files
committed
refactor(examples): add urban H3 urban layer starting point
1 parent 26a9545 commit ba38d92

File tree

2 files changed

+82
-6
lines changed

2 files changed

+82
-6
lines changed

docs/copy_of_examples/1-Per-Module/2-urban_layer.ipynb

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,18 @@
2020
},
2121
{
2222
"cell_type": "code",
23-
"execution_count": null,
24-
"metadata": {},
25-
"outputs": [],
23+
"execution_count": 1,
24+
"metadata": {},
25+
"outputs": [
26+
{
27+
"name": "stderr",
28+
"output_type": "stream",
29+
"text": [
30+
"/Users/sgp28/Desktop/Delivery/NYU/UrbanMapper/.venv/lib/python3.10/site-packages/DataProfileViewer/_plot_metadata_table.py:1: UserWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html. The pkg_resources package is slated for removal as early as 2025-11-30. Refrain from using this package or pin to Setuptools<81.\n",
31+
" import pkg_resources\n"
32+
]
33+
}
34+
],
2635
"source": [
2736
"import urban_mapper as um\n",
2837
"\n",
@@ -76,6 +85,35 @@
7685
"layer.static_render()"
7786
]
7887
},
88+
{
89+
"cell_type": "markdown",
90+
"metadata": {},
91+
"source": [
92+
"## Creating an Uber H3 Grid\n",
93+
"\n",
94+
"Generate a hexagonal grid over a place of interest using the `uber_h3` urban layer type."
95+
]
96+
},
97+
{
98+
"cell_type": "code",
99+
"metadata": {},
100+
"source": [
101+
"uber_h3_layer = (\n",
102+
" mapper.urban_layer.with_type(\"uber_h3\")\n",
103+
" .from_place(\"Manhattan, New York City, USA\", resolution=9)\n",
104+
" .with_mapping(\n",
105+
" longitude_column=\"longitude\",\n",
106+
" latitude_column=\"latitude\",\n",
107+
" output_column=\"nearest_h3_cell\",\n",
108+
" )\n",
109+
" .build()\n",
110+
")\n",
111+
"uber_h3_layer.preview()\n",
112+
"uber_h3_layer.static_render()"
113+
],
114+
"outputs": [],
115+
"execution_count": null
116+
},
79117
{
80118
"cell_type": "markdown",
81119
"metadata": {},

examples/1-Per-Module/2-urban_layer.ipynb

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,18 @@
2020
},
2121
{
2222
"cell_type": "code",
23-
"execution_count": null,
24-
"metadata": {},
25-
"outputs": [],
23+
"execution_count": 1,
24+
"metadata": {},
25+
"outputs": [
26+
{
27+
"name": "stderr",
28+
"output_type": "stream",
29+
"text": [
30+
"/Users/sgp28/Desktop/Delivery/NYU/UrbanMapper/.venv/lib/python3.10/site-packages/DataProfileViewer/_plot_metadata_table.py:1: UserWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html. The pkg_resources package is slated for removal as early as 2025-11-30. Refrain from using this package or pin to Setuptools<81.\n",
31+
" import pkg_resources\n"
32+
]
33+
}
34+
],
2635
"source": [
2736
"import urban_mapper as um\n",
2837
"\n",
@@ -76,6 +85,35 @@
7685
"layer.static_render()"
7786
]
7887
},
88+
{
89+
"cell_type": "markdown",
90+
"metadata": {},
91+
"source": [
92+
"## Creating an Uber H3 Grid\n",
93+
"\n",
94+
"Generate a hexagonal grid over a place of interest using the `uber_h3` urban layer type."
95+
]
96+
},
97+
{
98+
"cell_type": "code",
99+
"metadata": {},
100+
"source": [
101+
"uber_h3_layer = (\n",
102+
" mapper.urban_layer.with_type(\"uber_h3\")\n",
103+
" .from_place(\"Manhattan, New York City, USA\", resolution=9)\n",
104+
" .with_mapping(\n",
105+
" longitude_column=\"longitude\",\n",
106+
" latitude_column=\"latitude\",\n",
107+
" output_column=\"nearest_h3_cell\",\n",
108+
" )\n",
109+
" .build()\n",
110+
")\n",
111+
"uber_h3_layer.preview()\n",
112+
"uber_h3_layer.static_render()"
113+
],
114+
"outputs": [],
115+
"execution_count": null
116+
},
79117
{
80118
"cell_type": "markdown",
81119
"metadata": {},

0 commit comments

Comments
 (0)