Skip to content

Commit fa67204

Browse files
authored
fix: update Tanager STAC notebook to improve footprint visualization and package imports (#266)
1 parent cacb361 commit fa67204

1 file changed

Lines changed: 42 additions & 20 deletions

File tree

docs/examples/tanager_stac.ipynb

Lines changed: 42 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@
4747
"metadata": {},
4848
"outputs": [],
4949
"source": [
50-
"import hypercoast"
50+
"import hypercoast\n",
51+
"import geopandas as gpd"
5152
]
5253
},
5354
{
@@ -67,7 +68,7 @@
6768
"source": [
6869
"## Display Tanager footprints\n",
6970
"\n",
70-
"Use `tanager_footprints()` to collect STAC item footprints as a GeoDataFrame. By default, duplicate scenes that appear in multiple thematic collections are merged and their collection names are preserved in the `collections` and `collection_titles` columns.\n"
71+
"The [planet-open-data](https://github.com/opengeos/planet-open-data) repository provides GeoJSON files containing the footprints of Tanager products, which are being updated daily. The following code reads the GeoJSON file and visualizes the footprints on a map."
7172
]
7273
},
7374
{
@@ -77,8 +78,9 @@
7778
"metadata": {},
7879
"outputs": [],
7980
"source": [
80-
"footprints = hypercoast.tanager_footprints()\n",
81-
"len(footprints), footprints[[\"id\", \"collection_titles\", \"datetime\"]].head()"
81+
"url = \"https://raw.githubusercontent.com/opengeos/planet-open-data/refs/heads/main/data/planet-tanager-sample-products/footprints.geojson\"\n",
82+
"gdf = gpd.read_file(url)\n",
83+
"print(f\"Number of footprints: {len(gdf)}\")"
8284
]
8385
},
8486
{
@@ -87,24 +89,36 @@
8789
"id": "8",
8890
"metadata": {},
8991
"outputs": [],
92+
"source": [
93+
"gdf.head()"
94+
]
95+
},
96+
{
97+
"cell_type": "code",
98+
"execution_count": null,
99+
"id": "9",
100+
"metadata": {},
101+
"outputs": [],
90102
"source": [
91103
"m = hypercoast.Map()\n",
92-
"m.add_tanager_footprints(info_mode=\"on_click\")\n",
104+
"m.add_gdf(gdf, layer_name=\"Tanager Footprints\")\n",
93105
"m"
94106
]
95107
},
96108
{
97109
"cell_type": "markdown",
98-
"id": "9",
110+
"id": "10",
99111
"metadata": {},
100112
"source": [
101-
"Draw a rectangle on the map. "
113+
"## Search Tanager STAC items\n",
114+
"\n",
115+
"To search Tanager STAC items, draw a rectangle on the map. "
102116
]
103117
},
104118
{
105119
"cell_type": "code",
106120
"execution_count": null,
107-
"id": "10",
121+
"id": "11",
108122
"metadata": {},
109123
"outputs": [],
110124
"source": [
@@ -114,10 +128,18 @@
114128
" bbox = [-123.0, 37.0, -122.0, 38.1]"
115129
]
116130
},
131+
{
132+
"cell_type": "markdown",
133+
"id": "12",
134+
"metadata": {},
135+
"source": [
136+
"Search for Tanager data from the [Tanager STAC catalog](https://www.planet.com/data/stac/browser/tanager-core-imagery/catalog.json): "
137+
]
138+
},
117139
{
118140
"cell_type": "code",
119141
"execution_count": null,
120-
"id": "11",
142+
"id": "13",
121143
"metadata": {},
122144
"outputs": [],
123145
"source": [
@@ -132,7 +154,7 @@
132154
{
133155
"cell_type": "code",
134156
"execution_count": null,
135-
"id": "12",
157+
"id": "14",
136158
"metadata": {},
137159
"outputs": [],
138160
"source": [
@@ -142,7 +164,7 @@
142164
},
143165
{
144166
"cell_type": "markdown",
145-
"id": "13",
167+
"id": "15",
146168
"metadata": {},
147169
"source": [
148170
"## Visualize the ortho visual COG\n",
@@ -153,7 +175,7 @@
153175
{
154176
"cell_type": "code",
155177
"execution_count": null,
156-
"id": "14",
178+
"id": "16",
157179
"metadata": {},
158180
"outputs": [],
159181
"source": [
@@ -164,7 +186,7 @@
164186
{
165187
"cell_type": "code",
166188
"execution_count": null,
167-
"id": "15",
189+
"id": "17",
168190
"metadata": {},
169191
"outputs": [],
170192
"source": [
@@ -176,7 +198,7 @@
176198
},
177199
{
178200
"cell_type": "markdown",
179-
"id": "16",
201+
"id": "18",
180202
"metadata": {},
181203
"source": [
182204
"## Add a STAC item with spectral signatures\n",
@@ -187,7 +209,7 @@
187209
{
188210
"cell_type": "code",
189211
"execution_count": null,
190-
"id": "17",
212+
"id": "19",
191213
"metadata": {},
192214
"outputs": [],
193215
"source": [
@@ -200,7 +222,7 @@
200222
},
201223
{
202224
"cell_type": "markdown",
203-
"id": "18",
225+
"id": "20",
204226
"metadata": {},
205227
"source": [
206228
"## Download and read the spectral HDF5 asset\n",
@@ -211,7 +233,7 @@
211233
{
212234
"cell_type": "code",
213235
"execution_count": null,
214-
"id": "19",
236+
"id": "21",
215237
"metadata": {},
216238
"outputs": [],
217239
"source": [
@@ -226,7 +248,7 @@
226248
{
227249
"cell_type": "code",
228250
"execution_count": null,
229-
"id": "20",
251+
"id": "22",
230252
"metadata": {},
231253
"outputs": [],
232254
"source": [
@@ -242,7 +264,7 @@
242264
],
243265
"metadata": {
244266
"kernelspec": {
245-
"display_name": "hyper",
267+
"display_name": "geo",
246268
"language": "python",
247269
"name": "python3"
248270
},
@@ -256,7 +278,7 @@
256278
"name": "python",
257279
"nbconvert_exporter": "python",
258280
"pygments_lexer": "ipython3",
259-
"version": "3.10.14"
281+
"version": "3.12.12"
260282
}
261283
},
262284
"nbformat": 4,

0 commit comments

Comments
 (0)