Skip to content

Commit

Permalink
Updated notebooks 2024-02-19 UTC
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Feb 19, 2024
1 parent 6d39152 commit 90f426f
Show file tree
Hide file tree
Showing 73 changed files with 897 additions and 889 deletions.
42 changes: 21 additions & 21 deletions content/notebooks/00_key_features.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -159,16 +159,16 @@
"outputs": [],
"source": [
"m = leafmap.Map(center=[40, -100], zoom=4)\n",
"naip_url = 'https://www.mrlc.gov/geoserver/mrlc_display/NLCD_2019_Land_Cover_L48/wms?'\n",
"naip_url = \"https://www.mrlc.gov/geoserver/mrlc_display/NLCD_2019_Land_Cover_L48/wms?\"\n",
"m.add_wms_layer(\n",
" url=naip_url,\n",
" layers='NLCD_2019_Land_Cover_L48',\n",
" name='NLCD 2019',\n",
" attribution='MRLC',\n",
" format='image/png',\n",
" layers=\"NLCD_2019_Land_Cover_L48\",\n",
" name=\"NLCD 2019\",\n",
" attribution=\"MRLC\",\n",
" format=\"image/png\",\n",
" shown=True,\n",
")\n",
"m.add_legend(title='NLCD Land Cover Type', builtin_legend='NLCD')\n",
"m.add_legend(title=\"NLCD Land Cover Type\", builtin_legend=\"NLCD\")\n",
"m"
]
},
Expand All @@ -186,7 +186,7 @@
"outputs": [],
"source": [
"m = leafmap.Map()\n",
"url = 'https://github.com/opengeos/data/releases/download/raster/Libya-2023-07-01.tif'\n",
"url = \"https://github.com/opengeos/data/releases/download/raster/Libya-2023-07-01.tif\"\n",
"m.add_cog_layer(url, name=\"Fire (pre-event)\")\n",
"m"
]
Expand All @@ -205,8 +205,8 @@
"outputs": [],
"source": [
"m = leafmap.Map()\n",
"url = 'https://canada-spot-ortho.s3.amazonaws.com/canada_spot_orthoimages/canada_spot5_orthoimages/S5_2007/S5_11055_6057_20070622/S5_11055_6057_20070622.json'\n",
"m.add_stac_layer(url, bands=['B3', 'B2', 'B1'], name='False color')\n",
"url = \"https://canada-spot-ortho.s3.amazonaws.com/canada_spot_orthoimages/canada_spot5_orthoimages/S5_2007/S5_11055_6057_20070622/S5_11055_6057_20070622.json\"\n",
"m.add_stac_layer(url, bands=[\"B3\", \"B2\", \"B1\"], name=\"False color\")\n",
"m"
]
},
Expand All @@ -232,7 +232,7 @@
" format=\"image/png\",\n",
" transparent=True,\n",
")\n",
"m.add_legend(builtin_legend='NLCD')\n",
"m.add_legend(builtin_legend=\"NLCD\")\n",
"m"
]
},
Expand All @@ -250,8 +250,8 @@
"outputs": [],
"source": [
"m = leafmap.Map()\n",
"m.add_basemap('USGS 3DEP Elevation')\n",
"colors = ['006633', 'E5FFCC', '662A00', 'D8D8D8', 'F5F5F5']\n",
"m.add_basemap(\"USGS 3DEP Elevation\")\n",
"colors = [\"006633\", \"E5FFCC\", \"662A00\", \"D8D8D8\", \"F5F5F5\"]\n",
"vmin = 0\n",
"vmax = 4000\n",
"m.add_colorbar(colors=colors, vmin=vmin, vmax=vmax)\n",
Expand All @@ -272,7 +272,7 @@
"outputs": [],
"source": [
"m = leafmap.Map(center=[0, 0], zoom=2)\n",
"in_geojson = 'https://raw.githubusercontent.com/opengeos/leafmap/master/examples/data/cable_geo.geojson'\n",
"in_geojson = \"https://raw.githubusercontent.com/opengeos/leafmap/master/examples/data/cable_geo.geojson\"\n",
"m.add_geojson(in_geojson, layer_name=\"Cable lines\")\n",
"m"
]
Expand All @@ -286,12 +286,12 @@
"# Add a GeoJSON with random filled color to the map.\n",
"m = leafmap.Map(center=[0, 0], zoom=2)\n",
"url = \"https://raw.githubusercontent.com/opengeos/leafmap/master/examples/data/countries.geojson\"\n",
"style = {'fillOpacity': 0.5}\n",
"style = {\"fillOpacity\": 0.5}\n",
"m.add_geojson(\n",
" url,\n",
" layer_name=\"Countries\",\n",
" style=style,\n",
" fill_colors=['red', 'yellow', 'green', 'orange'],\n",
" fill_colors=[\"red\", \"yellow\", \"green\", \"orange\"],\n",
")\n",
"m"
]
Expand Down Expand Up @@ -333,7 +333,7 @@
"outputs": [],
"source": [
"m = leafmap.Map(center=[0, 0], zoom=2)\n",
"in_shp = 'https://github.com/opengeos/leafmap/raw/master/examples/data/countries.zip'\n",
"in_shp = \"https://github.com/opengeos/leafmap/raw/master/examples/data/countries.zip\"\n",
"m.add_shp(in_shp, layer_name=\"Countries\")\n",
"m"
]
Expand All @@ -354,8 +354,8 @@
"try:\n",
" import geopandas\n",
"except ImportError:\n",
" print('Installing geopandas ...')\n",
" subprocess.check_call([\"python\", '-m', 'pip', 'install', 'geopandas'])"
" print(\"Installing geopandas ...\")\n",
" subprocess.check_call([\"python\", \"-m\", \"pip\", \"install\", \"geopandas\"])"
]
},
{
Expand All @@ -365,7 +365,7 @@
"outputs": [],
"source": [
"m = leafmap.Map()\n",
"in_kml = 'https://raw.githubusercontent.com/opengeos/leafmap/master/examples/data/us_states.kml'\n",
"in_kml = \"https://raw.githubusercontent.com/opengeos/leafmap/master/examples/data/us_states.kml\"\n",
"m.add_kml(in_kml, layer_name=\"US States KML\")\n",
"m"
]
Expand Down Expand Up @@ -411,7 +411,7 @@
"m.add_heatmap(\n",
" in_csv,\n",
" latitude=\"latitude\",\n",
" longitude='longitude',\n",
" longitude=\"longitude\",\n",
" value=\"pop_max\",\n",
" name=\"Heat map\",\n",
" radius=20,\n",
Expand All @@ -424,7 +424,7 @@
"metadata": {},
"outputs": [],
"source": [
"colors = ['blue', 'lime', 'red']\n",
"colors = [\"blue\", \"lime\", \"red\"]\n",
"vmin = 0\n",
"vmax = 10000\n",
"m.add_colorbar(colors=colors, vmin=vmin, vmax=vmax)\n",
Expand Down
8 changes: 4 additions & 4 deletions content/notebooks/02_using_basemaps.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,9 @@
"outputs": [],
"source": [
"m = leafmap.Map()\n",
"naip_url = 'https://services.nationalmap.gov/arcgis/services/USGSNAIPImagery/ImageServer/WMSServer?'\n",
"naip_url = \"https://services.nationalmap.gov/arcgis/services/USGSNAIPImagery/ImageServer/WMSServer?\"\n",
"m.add_wms_layer(\n",
" url=naip_url, layers='0', name='NAIP Imagery', format='image/png', shown=True\n",
" url=naip_url, layers=\"0\", name=\"NAIP Imagery\", format=\"image/png\", shown=True\n",
")\n",
"m"
]
Expand All @@ -155,12 +155,12 @@
"\n",
"url1 = \"https://www.fws.gov/wetlands/arcgis/services/Wetlands/MapServer/WMSServer?\"\n",
"m.add_wms_layer(\n",
" url1, layers=\"1\", format='image/png', transparent=True, name=\"NWI Wetlands Vector\"\n",
" url1, layers=\"1\", format=\"image/png\", transparent=True, name=\"NWI Wetlands Vector\"\n",
")\n",
"\n",
"url2 = \"https://www.fws.gov/wetlands/arcgis/services/Wetlands_Raster/ImageServer/WMSServer?\"\n",
"m.add_wms_layer(\n",
" url2, layers=\"0\", format='image/png', transparent=True, name=\"NWI Wetlands Raster\"\n",
" url2, layers=\"0\", format=\"image/png\", transparent=True, name=\"NWI Wetlands Raster\"\n",
")\n",
"\n",
"m.add_legend(builtin_legend=\"NWI\")\n",
Expand Down
14 changes: 7 additions & 7 deletions content/notebooks/03_cog_stac.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"outputs": [],
"source": [
"# Use the TiTiler demo endpoint. Replace this if needed.\n",
"os.environ['TITILER_ENDPOINT'] = 'https://titiler.xyz'"
"os.environ[\"TITILER_ENDPOINT\"] = \"https://titiler.xyz\""
]
},
{
Expand All @@ -92,7 +92,7 @@
"metadata": {},
"outputs": [],
"source": [
"url = 'https://github.com/opengeos/data/releases/download/raster/Libya-2023-07-01.tif'"
"url = \"https://github.com/opengeos/data/releases/download/raster/Libya-2023-07-01.tif\""
]
},
{
Expand Down Expand Up @@ -181,7 +181,7 @@
"metadata": {},
"outputs": [],
"source": [
"url2 = 'https://github.com/opengeos/data/releases/download/raster/Libya-2023-09-13.tif'"
"url2 = \"https://github.com/opengeos/data/releases/download/raster/Libya-2023-09-13.tif\""
]
},
{
Expand Down Expand Up @@ -239,7 +239,7 @@
"metadata": {},
"outputs": [],
"source": [
"url = 'https://canada-spot-ortho.s3.amazonaws.com/canada_spot_orthoimages/canada_spot5_orthoimages/S5_2007/S5_11055_6057_20070622/S5_11055_6057_20070622.json'"
"url = \"https://canada-spot-ortho.s3.amazonaws.com/canada_spot_orthoimages/canada_spot5_orthoimages/S5_2007/S5_11055_6057_20070622/S5_11055_6057_20070622.json\""
]
},
{
Expand Down Expand Up @@ -303,7 +303,7 @@
"metadata": {},
"outputs": [],
"source": [
"leafmap.stac_tile(url, bands=['B3', 'B2', 'B1'])"
"leafmap.stac_tile(url, bands=[\"B3\", \"B2\", \"B1\"])"
]
},
{
Expand All @@ -319,7 +319,7 @@
"metadata": {},
"outputs": [],
"source": [
"Map.add_stac_layer(url, bands=['pan'], name='Panchromatic')"
"Map.add_stac_layer(url, bands=[\"pan\"], name=\"Panchromatic\")"
]
},
{
Expand All @@ -328,7 +328,7 @@
"metadata": {},
"outputs": [],
"source": [
"Map.add_stac_layer(url, bands=['B3', 'B2', 'B1'], name='False color')"
"Map.add_stac_layer(url, bands=[\"B3\", \"B2\", \"B1\"], name=\"False color\")"
]
},
{
Expand Down
8 changes: 4 additions & 4 deletions content/notebooks/04_cog_mosaic.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
"metadata": {},
"outputs": [],
"source": [
"pre_fire_url = 'https://raw.githubusercontent.com/opengeos/leafmap/master/examples/data/cog_pre_event.txt'"
"pre_fire_url = \"https://raw.githubusercontent.com/opengeos/leafmap/master/examples/data/cog_pre_event.txt\""
]
},
{
Expand All @@ -99,7 +99,7 @@
"metadata": {},
"outputs": [],
"source": [
"post_fire_url = 'https://raw.githubusercontent.com/opengeos/leafmap/master/examples/data/cog_post_event.txt'"
"post_fire_url = \"https://raw.githubusercontent.com/opengeos/leafmap/master/examples/data/cog_post_event.txt\""
]
},
{
Expand Down Expand Up @@ -143,7 +143,7 @@
"outputs": [],
"source": [
"pre_event_tile = (\n",
" 'https://titiler.xyz/mosaicjson/anonymous.layer_pqmra/tiles/{z}/{x}/{y}@1x?'\n",
" \"https://titiler.xyz/mosaicjson/anonymous.layer_pqmra/tiles/{z}/{x}/{y}@1x?\"\n",
")\n",
"m.add_tile_layer(pre_event_tile, name=\"Pre-event\", attribution=\"Maxar\")"
]
Expand All @@ -155,7 +155,7 @@
"outputs": [],
"source": [
"post_event_tile = (\n",
" 'https://titiler.xyz/mosaicjson/anonymous.layer_qdano/tiles/{z}/{x}/{y}@1x?'\n",
" \"https://titiler.xyz/mosaicjson/anonymous.layer_qdano/tiles/{z}/{x}/{y}@1x?\"\n",
")\n",
"m.add_tile_layer(post_event_tile, name=\"Post-event\", attribution=\"Maxar\")"
]
Expand Down
8 changes: 4 additions & 4 deletions content/notebooks/05_load_raster.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@
"metadata": {},
"outputs": [],
"source": [
"landsat = 'landsat.tif'\n",
"dem = 'dem.tif'"
"landsat = \"landsat.tif\"\n",
"dem = \"dem.tif\""
]
},
{
Expand Down Expand Up @@ -121,7 +121,7 @@
"metadata": {},
"outputs": [],
"source": [
"m.add_raster(dem, colormap='terrain', layer_name='DEM')"
"m.add_raster(dem, colormap=\"terrain\", layer_name=\"DEM\")"
]
},
{
Expand All @@ -130,7 +130,7 @@
"metadata": {},
"outputs": [],
"source": [
"m.add_raster(landsat, bands=[5, 4, 3], layer_name='Landsat')"
"m.add_raster(landsat, bands=[5, 4, 3], layer_name=\"Landsat\")"
]
},
{
Expand Down
52 changes: 26 additions & 26 deletions content/notebooks/06_legend.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
" format=\"image/png\",\n",
" transparent=True,\n",
")\n",
"Map.add_legend(builtin_legend='NLCD')\n",
"Map.add_legend(builtin_legend=\"NLCD\")\n",
"\n",
"Map"
]
Expand All @@ -118,12 +118,12 @@
"\n",
"url1 = \"https://www.fws.gov/wetlands/arcgis/services/Wetlands/MapServer/WMSServer?\"\n",
"Map.add_wms_layer(\n",
" url1, layers=\"1\", format='image/png', transparent=True, name=\"NWI Wetlands Vector\"\n",
" url1, layers=\"1\", format=\"image/png\", transparent=True, name=\"NWI Wetlands Vector\"\n",
")\n",
"\n",
"url2 = \"https://www.fws.gov/wetlands/arcgis/services/Wetlands_Raster/ImageServer/WMSServer?\"\n",
"Map.add_wms_layer(\n",
" url2, layers=\"0\", format='image/png', transparent=True, name=\"NWI Wetlands Raster\"\n",
" url2, layers=\"0\", format=\"image/png\", transparent=True, name=\"NWI Wetlands Raster\"\n",
")\n",
"\n",
"Map.add_legend(builtin_legend=\"NWI\")\n",
Expand Down Expand Up @@ -152,12 +152,12 @@
"source": [
"Map = leafmap.Map()\n",
"\n",
"labels = ['One', 'Two', 'Three', 'Four', 'ect']\n",
"labels = [\"One\", \"Two\", \"Three\", \"Four\", \"etc\"]\n",
"# color can be defined using either hex code or RGB (0-255, 0-255, 0-255)\n",
"colors = ['#8DD3C7', '#FFFFB3', '#BEBADA', '#FB8072', '#80B1D3']\n",
"colors = [\"#8DD3C7\", \"#FFFFB3\", \"#BEBADA\", \"#FB8072\", \"#80B1D3\"]\n",
"# colors = [(255, 0, 0), (127, 255, 0), (127, 18, 25), (36, 70, 180), (96, 68, 123)]\n",
"\n",
"Map.add_legend(title='Legend', labels=labels, colors=colors)\n",
"Map.add_legend(title=\"Legend\", labels=labels, colors=colors)\n",
"Map"
]
},
Expand Down Expand Up @@ -186,26 +186,26 @@
")\n",
"\n",
"legend_dict = {\n",
" '11 Open Water': '466b9f',\n",
" '12 Perennial Ice/Snow': 'd1def8',\n",
" '21 Developed, Open Space': 'dec5c5',\n",
" '22 Developed, Low Intensity': 'd99282',\n",
" '23 Developed, Medium Intensity': 'eb0000',\n",
" '24 Developed High Intensity': 'ab0000',\n",
" '31 Barren Land (Rock/Sand/Clay)': 'b3ac9f',\n",
" '41 Deciduous Forest': '68ab5f',\n",
" '42 Evergreen Forest': '1c5f2c',\n",
" '43 Mixed Forest': 'b5c58f',\n",
" '51 Dwarf Scrub': 'af963c',\n",
" '52 Shrub/Scrub': 'ccb879',\n",
" '71 Grassland/Herbaceous': 'dfdfc2',\n",
" '72 Sedge/Herbaceous': 'd1d182',\n",
" '73 Lichens': 'a3cc51',\n",
" '74 Moss': '82ba9e',\n",
" '81 Pasture/Hay': 'dcd939',\n",
" '82 Cultivated Crops': 'ab6c28',\n",
" '90 Woody Wetlands': 'b8d9eb',\n",
" '95 Emergent Herbaceous Wetlands': '6c9fb8',\n",
" \"11 Open Water\": \"466b9f\",\n",
" \"12 Perennial Ice/Snow\": \"d1def8\",\n",
" \"21 Developed, Open Space\": \"dec5c5\",\n",
" \"22 Developed, Low Intensity\": \"d99282\",\n",
" \"23 Developed, Medium Intensity\": \"eb0000\",\n",
" \"24 Developed High Intensity\": \"ab0000\",\n",
" \"31 Barren Land (Rock/Sand/Clay)\": \"b3ac9f\",\n",
" \"41 Deciduous Forest\": \"68ab5f\",\n",
" \"42 Evergreen Forest\": \"1c5f2c\",\n",
" \"43 Mixed Forest\": \"b5c58f\",\n",
" \"51 Dwarf Scrub\": \"af963c\",\n",
" \"52 Shrub/Scrub\": \"ccb879\",\n",
" \"71 Grassland/Herbaceous\": \"dfdfc2\",\n",
" \"72 Sedge/Herbaceous\": \"d1d182\",\n",
" \"73 Lichens\": \"a3cc51\",\n",
" \"74 Moss\": \"82ba9e\",\n",
" \"81 Pasture/Hay\": \"dcd939\",\n",
" \"82 Cultivated Crops\": \"ab6c28\",\n",
" \"90 Woody Wetlands\": \"b8d9eb\",\n",
" \"95 Emergent Herbaceous Wetlands\": \"6c9fb8\",\n",
"}\n",
"\n",
"Map.add_legend(title=\"NLCD Land Cover Classification\", legend_dict=legend_dict)\n",
Expand Down
4 changes: 2 additions & 2 deletions content/notebooks/07_colorbar.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
"metadata": {},
"outputs": [],
"source": [
"colors = ['006633', 'E5FFCC', '662A00', 'D8D8D8', 'F5F5F5']\n",
"colors = [\"006633\", \"E5FFCC\", \"662A00\", \"D8D8D8\", \"F5F5F5\"]\n",
"vmin = 0\n",
"vmax = 4000\n",
"\n",
Expand Down Expand Up @@ -126,7 +126,7 @@
"metadata": {},
"outputs": [],
"source": [
"colors = ['006633', 'E5FFCC', '662A00', 'D8D8D8', 'F5F5F5']\n",
"colors = [\"006633\", \"E5FFCC\", \"662A00\", \"D8D8D8\", \"F5F5F5\"]\n",
"vmin = 0\n",
"vmax = 4000\n",
"\n",
Expand Down
Loading

0 comments on commit 90f426f

Please sign in to comment.