Spaces:
Sleeping
Sleeping
File size: 1,355 Bytes
1411614 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import requests\n",
"\n",
"url = \"https://giswqs-ee-tile-request.hf.space/tile\"\n",
"\n",
"payload = {\n",
" \"asset_id\": \"USGS/SRTMGL1_003\",\n",
" \"vis_params\": {\"min\": 0, \"max\": 5000, \"palette\": \"terrain\"},\n",
"}\n",
"\n",
"response = requests.post(url, json=payload)\n",
"\n",
"if response.ok:\n",
" print(\"Tile URL:\", response.json()[\"tile_url\"])\n",
"else:\n",
" print(\"Error:\", response.text)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import leafmap.maplibregl as leafmap\n",
"\n",
"m = leafmap.Map(projection=\"globe\")\n",
"url = response.json()[\"tile_url\"]\n",
"m.add_tile_layer(url)\n",
"m"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "geo",
"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.12.2"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
|