|
214 | 214 | ],
|
215 | 215 | "source": [
|
216 | 216 | "# 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", |
219 | 219 | "map1.layout = Layout(flex=\"1 1\", height=\"500px\", padding=\"10px\")\n",
|
220 | 220 | "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", |
223 | 223 | "box = HBox([map1, map2])\n",
|
224 | 224 | "box"
|
225 | 225 | ]
|
226 | 226 | },
|
| 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 | + }, |
227 | 237 | {
|
228 | 238 | "cell_type": "markdown",
|
229 | 239 | "metadata": {},
|
|
634 | 644 | "source": [
|
635 | 645 | "# Create three maps to compare before and after imageries\n",
|
636 | 646 | "# 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", |
640 | 650 | "map1.layout = Layout(flex=\"1 1\", height=\"500px\", padding=\"5px\")\n",
|
641 | 651 | "map2.layout = Layout(flex=\"1 1\", height=\"500px\", padding=\"5px\")\n",
|
642 | 652 | "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", |
646 | 656 | "box = HBox([map1, map2, map3])\n",
|
647 | 657 | "box"
|
648 | 658 | ]
|
649 | 659 | },
|
| 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 | + }, |
650 | 671 | {
|
651 | 672 | "cell_type": "markdown",
|
652 | 673 | "metadata": {},
|
|
810 | 831 | "# Save the final result as a web map\n",
|
811 | 832 | "landslide_by_basin_map = gis.map(\"-122.58, 38.45\", 10)\n",
|
812 | 833 | "\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", |
814 | 835 | " 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", |
816 | 837 | " options={\"title\": \"Landslide risk\",\n",
|
817 | 838 | " \"visibility\": False})\n",
|
818 |
| - "landslide_by_basin_map.add_layer(infrared_before,\n", |
| 839 | + "landslide_by_basin_map.content.add(infrared_before,\n", |
819 | 840 | " options={\"title\": \"Pre fire satellite imagery\",\n",
|
820 | 841 | " \"visibility\": False})\n",
|
821 |
| - "landslide_by_basin_map.add_layer(infrared_after,\n", |
| 842 | + "landslide_by_basin_map.content.add(infrared_after,\n", |
822 | 843 | " options={\"title\": \"Post fire satellite imagery\",\n",
|
823 | 844 | " \"visibility\": False})\n",
|
824 |
| - "landslide_by_basin_map.add_layer(dem,\n", |
| 845 | + "landslide_by_basin_map.content.add(dem,\n", |
825 | 846 | " options={\"title\": \"Elevation layer used to derive slope\",\n",
|
826 | 847 | " \"visibility\": False})\n",
|
827 |
| - "landslide_by_basin_map.add_layer(nlcd,\n", |
| 848 | + "landslide_by_basin_map.content.add(nlcd,\n", |
828 | 849 | " options={\"title\": \"National LandCover Dataset\",\n",
|
829 | 850 | " \"visibility\": False})\n",
|
830 |
| - "landslide_by_basin_map.add_layer(basins,\n", |
| 851 | + "landslide_by_basin_map.content.add(basins,\n", |
831 | 852 | " options={\"title\": \"Watershed basins\",\n",
|
832 | 853 | " \"visibility\": False})\n",
|
833 | 854 | "\n",
|
834 |
| - "landslide_by_basin_map.add_layer(infrared_after)\n", |
| 855 | + "landslide_by_basin_map.content.add(infrared_after)\n", |
835 | 856 | "landslide_by_basin_map.save({\"title\": f\"Landslide risk map {dt.now().strftime('%Y%m%d%H%M%S')}\",\n",
|
836 | 857 | " \"tags\": [\"landslide\", \"analysis\", \"forest fire\"],\n",
|
837 | 858 | " \"snippet\": \"Landslide risk map per basin.\"})"
|
|
0 commit comments