Spaces:
Sleeping
Sleeping
File size: 3,124 Bytes
cd11da1 |
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 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "0",
"metadata": {},
"outputs": [],
"source": [
"# %pip install leafmap"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "1",
"metadata": {},
"outputs": [],
"source": [
"import leafmap.maplibregl as leafmap\n",
"import ipywidgets as widgets"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "2",
"metadata": {},
"outputs": [],
"source": [
"tw = leafmap.TabWidget(\n",
" title=\"Interactive Dashboard\",\n",
" tabs=(\"Home\", \"Map\", \"Population\", \"Settings\"),\n",
" icons=(\"mdi-home\", \"mdi-airplane\", \"mdi-account-box\", \"mdi-cog\"),\n",
" show_panel_titles=False,\n",
")\n",
"\n",
"# Customize dialog\n",
"tw.set_help_title(\"About this dashboard\")\n",
"tw.set_help_content(\n",
" widgets.HTML(\n",
" \"\"\"\n",
" <p><b>User Guide</b></p>\n",
" <ul>\n",
" <li>Step 1: Click on the tab</li>\n",
" <li>Navigate the map</li>\n",
" <li>? — help</li>\n",
" </ul>\n",
" \"\"\"\n",
" )\n",
")\n",
"\n",
"m = leafmap.Map(projection=\"globe\", sidebar_visible=True, height=\"600px\")\n",
"m.add_overture_3d_buildings()\n",
"m.create_container()\n",
"\n",
"home_tab = widgets.HTML(\n",
" \"\"\"\n",
" <h1>Welcome to the Leafmap Visualization Dashboard</h1>\n",
" <p>This is the home tab.</p>\n",
" <img src=\"https://assets.gishub.org/images/geog-312.png\" width=\"100%\">\n",
" \"\"\"\n",
")\n",
"\n",
"settings_tab = widgets.HTML(\n",
" \"\"\"\n",
" <h1>Settings</h1>\n",
" <p>This is the settings tab.</p>\n",
" \"\"\"\n",
")\n",
"\n",
"data = \"https://github.com/opengeos/datasets/releases/download/vector/countries.geojson\"\n",
"\n",
"m2 = leafmap.Map(style=\"liberty\", projection=\"globe\")\n",
"first_symbol_id = m2.find_first_symbol_layer()[\"id\"]\n",
"m2.add_data(\n",
" data,\n",
" column=\"POP_EST\",\n",
" scheme=\"Quantiles\",\n",
" cmap=\"Blues\",\n",
" legend_title=\"Population\",\n",
" name=\"population\",\n",
" # before_id=first_symbol_id,\n",
" extrude=True,\n",
" scale_factor=1000,\n",
")\n",
"container = m2.create_container()\n",
"\n",
"tw.set_tab_content(0, home_tab)\n",
"tw.set_tab_content(1, m.container)\n",
"tw.set_tab_content(3, settings_tab)\n",
"tw.set_tab_content(2, m2.container)\n",
"\n",
"tw.widget"
]
}
],
"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": 5
}
|