Skip to content

Commit 8ad93e1

Browse files
committed
use new map widget syntax
1 parent 03f8bfb commit 8ad93e1

File tree

1 file changed

+39
-18
lines changed

1 file changed

+39
-18
lines changed

samples/04_gis_analysts_data_scientists/calculate_post_fire_landslide_risk.ipynb

Lines changed: 39 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -214,16 +214,26 @@
214214
],
215215
"source": [
216216
"# Create two maps to compare before and after imageries side by side\n",
217-
"map1 = gis.map(location=\"-122.58, 38.45\", zoomlevel=10)\n",
218-
"map2 = gis.map(location=\"-122.58, 38.45\", zoomlevel=10)\n",
217+
"map1 = gis.map(location=\"-122.58, 38.45\")\n",
218+
"map2 = gis.map(location=\"-122.58, 38.45\")\n",
219219
"map1.layout = Layout(flex=\"1 1\", height=\"500px\", padding=\"10px\")\n",
220220
"map2.layout = Layout(flex=\"1 1\", height=\"500px\", padding=\"10px\")\n",
221-
"map1.add_layer(infrared_before)\n",
222-
"map2.add_layer(infrared_after)\n",
221+
"map1.content.add(infrared_before)\n",
222+
"map2.content.add(infrared_after)\n",
223223
"box = HBox([map1, map2])\n",
224224
"box"
225225
]
226226
},
227+
{
228+
"cell_type": "code",
229+
"execution_count": null,
230+
"metadata": {},
231+
"outputs": [],
232+
"source": [
233+
"map1.zoom = 10\n",
234+
"map2.zoom = 10"
235+
]
236+
},
227237
{
228238
"cell_type": "markdown",
229239
"metadata": {},
@@ -634,19 +644,30 @@
634644
"source": [
635645
"# Create three maps to compare before and after imageries\n",
636646
"# and the landslide risk map side by side\n",
637-
"map1 = gis.map(location=\"-122.58, 38.45\", zoomlevel=15)\n",
638-
"map2 = gis.map(location=\"-122.58, 38.45\", zoomlevel=15)\n",
639-
"map3 = gis.map(location=\"-122.58, 38.45\", zoomlevel=15)\n",
647+
"map1 = gis.map(location=\"-122.58, 38.45\")\n",
648+
"map2 = gis.map(location=\"-122.58, 38.45\")\n",
649+
"map3 = gis.map(location=\"-122.58, 38.45\")\n",
640650
"map1.layout = Layout(flex=\"1 1\", height=\"500px\", padding=\"5px\")\n",
641651
"map2.layout = Layout(flex=\"1 1\", height=\"500px\", padding=\"5px\")\n",
642652
"map3.layout = Layout(flex=\"1 1\", height=\"500px\", padding=\"5px\")\n",
643-
"map1.add_layer(infrared_before)\n",
644-
"map2.add_layer(infrared_after)\n",
645-
"map3.add_layer(landslide_risk)\n",
653+
"map1.content.add(infrared_before)\n",
654+
"map2.content.add(infrared_after)\n",
655+
"map3.content.add(landslide_risk)\n",
646656
"box = HBox([map1, map2, map3])\n",
647657
"box"
648658
]
649659
},
660+
{
661+
"cell_type": "code",
662+
"execution_count": null,
663+
"metadata": {},
664+
"outputs": [],
665+
"source": [
666+
"map1.zoom = 15\n",
667+
"map2.zoom = 15\n",
668+
"map3.zoom = 15"
669+
]
670+
},
650671
{
651672
"cell_type": "markdown",
652673
"metadata": {},
@@ -810,28 +831,28 @@
810831
"# Save the final result as a web map\n",
811832
"landslide_by_basin_map = gis.map(\"-122.58, 38.45\", 10)\n",
812833
"\n",
813-
"landslide_by_basin_map.add_layer(landslide_risk_per_basin_saved,\n",
834+
"landslide_by_basin_map.content.add(landslide_risk_per_basin_saved,\n",
814835
" options={\"title\": \"Landslide risk aggregated per basin\"})\n",
815-
"landslide_by_basin_map.add_layer(landslide_risk,\n",
836+
"landslide_by_basin_map.content.add(landslide_risk,\n",
816837
" options={\"title\": \"Landslide risk\",\n",
817838
" \"visibility\": False})\n",
818-
"landslide_by_basin_map.add_layer(infrared_before,\n",
839+
"landslide_by_basin_map.content.add(infrared_before,\n",
819840
" options={\"title\": \"Pre fire satellite imagery\",\n",
820841
" \"visibility\": False})\n",
821-
"landslide_by_basin_map.add_layer(infrared_after,\n",
842+
"landslide_by_basin_map.content.add(infrared_after,\n",
822843
" options={\"title\": \"Post fire satellite imagery\",\n",
823844
" \"visibility\": False})\n",
824-
"landslide_by_basin_map.add_layer(dem,\n",
845+
"landslide_by_basin_map.content.add(dem,\n",
825846
" options={\"title\": \"Elevation layer used to derive slope\",\n",
826847
" \"visibility\": False})\n",
827-
"landslide_by_basin_map.add_layer(nlcd,\n",
848+
"landslide_by_basin_map.content.add(nlcd,\n",
828849
" options={\"title\": \"National LandCover Dataset\",\n",
829850
" \"visibility\": False})\n",
830-
"landslide_by_basin_map.add_layer(basins,\n",
851+
"landslide_by_basin_map.content.add(basins,\n",
831852
" options={\"title\": \"Watershed basins\",\n",
832853
" \"visibility\": False})\n",
833854
"\n",
834-
"landslide_by_basin_map.add_layer(infrared_after)\n",
855+
"landslide_by_basin_map.content.add(infrared_after)\n",
835856
"landslide_by_basin_map.save({\"title\": f\"Landslide risk map {dt.now().strftime('%Y%m%d%H%M%S')}\",\n",
836857
" \"tags\": [\"landslide\", \"analysis\", \"forest fire\"],\n",
837858
" \"snippet\": \"Landslide risk map per basin.\"})"

0 commit comments

Comments
 (0)