Skip to content

Commit

Permalink
add suggestions to stac-browser content
Browse files Browse the repository at this point in the history
  • Loading branch information
pjhartzell authored and jpolchlo committed Jun 23, 2023
1 parent 4b49842 commit 3021242
Showing 1 changed file with 10 additions and 20 deletions.
30 changes: 10 additions & 20 deletions docs/tutorials/creating-a-landsat-stac.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2426,7 +2426,7 @@
" 'href': './LC90140322022281/LC90140322022281.json',\n",
" 'type': 'application/json'},\n",
" {'rel': 'self',\n",
" 'href': '/home/jpolchlopek/Philly-landsat-stac/collection.json',\n",
" 'href': '/Users/pjh/Philly-landsat-stac/collection.json',\n",
" 'type': 'application/json'}],\n",
" 'title': '2022 Landsat images over philly',\n",
" 'extent': {'spatial': {'bbox': [[-76.29048, 39.25502, -73.48833, 41.38441]]},\n",
Expand Down Expand Up @@ -2457,33 +2457,20 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"However, if we want to browse our STAC more interactively, we can use the [stac-browser](https://github.com/radiantearth/stac-browser) tool to read our local STAC.\n",
"However, if we want to browse our STAC more interactively, we can serve the Collection from a local webserver and then browse the Collection with [stac-browser](https://github.com/radiantearth/stac-browser).\n",
"\n",
"We can use this simple Python server (copied from [this gist](https://gist.github.com/acdha/925e9ffc3d74ad59c3ea)) to serve our our directory at port 5555:"
]
},
{
"cell_type": "code",
"execution_count": 55,
"execution_count": null,
"metadata": {},
"outputs": [
{
"ename": "KeyboardInterrupt",
"evalue": "",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mKeyboardInterrupt\u001b[0m Traceback (most recent call last)",
"Cell \u001b[0;32mIn[55], line 16\u001b[0m\n\u001b[1;32m 12\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28msuper\u001b[39m(CORSRequestHandler, \u001b[38;5;28mself\u001b[39m)\u001b[38;5;241m.\u001b[39mend_headers()\n\u001b[1;32m 15\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m HTTPServer((\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mlocalhost\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;241m5555\u001b[39m), CORSRequestHandler) \u001b[38;5;28;01mas\u001b[39;00m httpd:\n\u001b[0;32m---> 16\u001b[0m \u001b[43mhttpd\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mserve_forever\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n",
"File \u001b[0;32m/usr/lib/python3.8/socketserver.py:232\u001b[0m, in \u001b[0;36mBaseServer.serve_forever\u001b[0;34m(self, poll_interval)\u001b[0m\n\u001b[1;32m 229\u001b[0m selector\u001b[38;5;241m.\u001b[39mregister(\u001b[38;5;28mself\u001b[39m, selectors\u001b[38;5;241m.\u001b[39mEVENT_READ)\n\u001b[1;32m 231\u001b[0m \u001b[38;5;28;01mwhile\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m__shutdown_request:\n\u001b[0;32m--> 232\u001b[0m ready \u001b[38;5;241m=\u001b[39m \u001b[43mselector\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mselect\u001b[49m\u001b[43m(\u001b[49m\u001b[43mpoll_interval\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 233\u001b[0m \u001b[38;5;66;03m# bpo-35017: shutdown() called during select(), exit immediately.\u001b[39;00m\n\u001b[1;32m 234\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m__shutdown_request:\n",
"File \u001b[0;32m/usr/lib/python3.8/selectors.py:415\u001b[0m, in \u001b[0;36m_PollLikeSelector.select\u001b[0;34m(self, timeout)\u001b[0m\n\u001b[1;32m 413\u001b[0m ready \u001b[38;5;241m=\u001b[39m []\n\u001b[1;32m 414\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m--> 415\u001b[0m fd_event_list \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_selector\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mpoll\u001b[49m\u001b[43m(\u001b[49m\u001b[43mtimeout\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 416\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mInterruptedError\u001b[39;00m:\n\u001b[1;32m 417\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m ready\n",
"\u001b[0;31mKeyboardInterrupt\u001b[0m: "
]
}
],
"outputs": [],
"source": [
"import os\n",
"from http.server import HTTPServer, SimpleHTTPRequestHandler\n",
Expand All @@ -2504,10 +2491,13 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"Now you can follow the [stac-browser](https://github.com/radiantearth/stac-browser#running) instructions for starting a stac-browser instance and point it at `http://localhost:5555/collection.json` to serve out the STAC!\n",
"Now we can browse our STAC Collection with stac-browser in a few different ways:\n",
"1. Follow the [instructions](https://github.com/radiantearth/stac-browser/blob/main/local_files.md) for starting a stac-browser instance and point it at `http://localhost:5555/collection.json` to serve out the STAC.\n",
"2. If you want to avoid setting up your own stac-browser instance, you can use the [STAC Browser Demo](https://radiantearth.github.io/stac-browser/) hosted by Radiant Earth: [https://radiantearth.github.io/stac-browser/#/http://localhost:5555/collection.json](https://radiantearth.github.io/stac-browser/#/http://localhost:5555/collection.json)\n",
"\n",
"To quit the server, use the `Kernel` -> `Interrupt` menu option."
]
Expand Down Expand Up @@ -2538,7 +2528,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.16"
"version": "3.11.1"
}
},
"nbformat": 4,
Expand Down

0 comments on commit 3021242

Please sign in to comment.