diff --git a/samples/04_gis_analysts_data_scientists/fighting_california_forest_fires_using_spatial_analysis.ipynb b/samples/04_gis_analysts_data_scientists/fighting_california_forest_fires_using_spatial_analysis.ipynb index e86dfa3cc..8e48a6e1a 100644 --- a/samples/04_gis_analysts_data_scientists/fighting_california_forest_fires_using_spatial_analysis.ipynb +++ b/samples/04_gis_analysts_data_scientists/fighting_california_forest_fires_using_spatial_analysis.ipynb @@ -30,7 +30,7 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 13, "metadata": {}, "outputs": [], "source": [ @@ -41,7 +41,7 @@ "import pandas as pd\n", "\n", "# create a Web GIS object\n", - "gis = GIS(profile='your_enterprise_profile')" + "gis = GIS(profile=\"your_enterprise_profile\")" ] }, { @@ -57,7 +57,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 14, "metadata": {}, "outputs": [ { @@ -65,19 +65,19 @@ "text/html": [ "
\n", "
\n", - " \n", - " \n", + " \n", + " \n", " \n", "
\n", "\n", "
\n", - " LA County Emergency Management\n", + " LA County Emergency Management\n", " \n", "
\n", "
Summary: Group providing data relevant to emergencies in Los Angeles, California, USA.\n", "
Description: None\n", "
Owner: api_data_owner\n", - "
Created: March 22, 2024\n", + "
Created: March 21, 2024\n", "\n", "
\n", "
\n", @@ -87,7 +87,7 @@ "" ] }, - "execution_count": 2, + "execution_count": 14, "metadata": {}, "output_type": "execute_result" } @@ -100,7 +100,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 15, "metadata": {}, "outputs": [ { @@ -108,17 +108,17 @@ "text/html": [ "
\n", "
\n", - " \n", + " \n", " \n", " \n", "
\n", "\n", "
\n", - " Active California Fires\n", + " Active California Fires\n", " \n", - "
Fires in Southern California active during 2016-2017.Feature Layer Collection by api_data_owner\n", + "
Fires in Southern California active during 2016-2017.
Feature Layer Collection by api_data_owner\n", "
Last Modified: December 19, 2023\n", - "
0 comments, 6 views\n", + "
0 comments, 18 views\n", "
\n", "
\n", " " @@ -135,17 +135,17 @@ "text/html": [ "
\n", "
\n", - " \n", + " \n", " \n", " \n", "
\n", "\n", "
\n", - " Critical Infrastructure in Southern California\n", + " Critical Infrastructure in Southern California\n", " \n", - "
Essential facilities to public health and safety in Southern California.Feature Layer Collection by api_data_owner\n", + "
Essential facilities to public health and safety in Southern California.
Feature Layer Collection by api_data_owner\n", "
Last Modified: December 19, 2023\n", - "
0 comments, 6 views\n", + "
0 comments, 14 views\n", "
\n", "
\n", " " @@ -162,17 +162,17 @@ "text/html": [ "
\n", "
\n", - " \n", + " \n", " \n", " \n", "
\n", "\n", "
\n", - " LA County Infrastructure At Risk\n", + " LA County Infrastructure At Risk\n", " \n", - "
A Web Map with critical infrastructure at risk from fires.Web Map by api_data_owner\n", + "
A Web Map with critical infrastructure at risk from fires.
Web Map by api_data_owner\n", "
Last Modified: December 20, 2023\n", - "
0 comments, 5 views\n", + "
0 comments, 35 views\n", "
\n", "
\n", " " @@ -202,15 +202,23 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 16, "metadata": {}, "outputs": [ { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n" - ] + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "1a51d8d0698e41cc8204a3e1f93fc55c", + "version_major": 2, + "version_minor": 1 + }, + "text/plain": [ + "Map(center=[4035818.471878221, -13162788.84377388], extent={'xmin': -13195962.052030275, 'ymin': 3995849.73900…" + ] + }, + "execution_count": 16, + "metadata": {}, + "output_type": "execute_result" } ], "source": [ @@ -233,29 +241,29 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 17, "metadata": {}, "outputs": [], "source": [ "# add the active fires layer\n", "fires = items[0]\n", - "m.add_layer(fires)" + "m.content.add(fires)" ] }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 18, "metadata": {}, "outputs": [], "source": [ "# add our critical infrastructure layer\n", "infra = items[1]\n", - "m.add_layer(infra)" + "m.content.add(infra)" ] }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 19, "metadata": {}, "outputs": [], "source": [ @@ -265,17 +273,9 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 20, "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n" - ] - } - ], + "outputs": [], "source": [ "# create a map of our area of interest\n", "m1 = gis.map('Los Angeles', 9)\n", @@ -296,27 +296,27 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 21, "metadata": {}, "outputs": [], "source": [ "#add the active fires layer to the map\n", - "m1.add_layer(fires)" + "m1.content.add(fires)" ] }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 22, "metadata": {}, "outputs": [], "source": [ "#add the critical infrastructure layer to the map\n", - "m1.add_layer(infra)" + "m1.content.add(infra)" ] }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 23, "metadata": {}, "outputs": [], "source": [ @@ -337,7 +337,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -354,12 +354,12 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# add risk areas to map\n", - "m1.add_layer(firebuffers)" + "m1.content.add(firebuffers)" ] }, { @@ -375,7 +375,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -389,7 +389,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": null, "metadata": { "scrolled": true }, @@ -408,18 +408,15 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": null, "metadata": {}, "outputs": [ { - "data": { - "text/plain": [ - "[]" - ] - }, - "execution_count": 16, - "metadata": {}, - "output_type": "execute_result" + "name": "stdout", + "output_type": "stream", + "text": [ + "[]\n" + ] } ], "source": [ @@ -440,10 +437,9 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": null, "metadata": {}, - "outputs": [ - { + "outputs": [{ "data": { "text/html": [ "
\n", @@ -731,8 +727,7 @@ "execution_count": 17, "metadata": {}, "output_type": "execute_result" - } - ], + }], "source": [ "at_risk_facilities = riskinfra.layers[0]\n", "df = at_risk_facilities.query(as_df=True) # read the returned features as a Pandas dataframe\n", @@ -748,10 +743,9 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": null, "metadata": {}, - "outputs": [ - { + "outputs": [{ "data": { "text/html": [ "
\n", @@ -847,8 +841,7 @@ "execution_count": 18, "metadata": {}, "output_type": "execute_result" - } - ], + }], "source": [ "# view simplified risk facilities table\n", "df1_simplified = df[['name', 'cat1', 'post_id']]\n", @@ -857,7 +850,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -877,17 +870,9 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": null, "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n" - ] - } - ], + "outputs": [], "source": [ "# create new map over aoi\n", "m2 = gis.map('Los Angeles', 9)\n", @@ -908,22 +893,22 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ "#add the critical infrastructure layer to the map\n", - "m2.add_layer(infra)" + "m2.content.add(infra)" ] }, { "cell_type": "code", - "execution_count": 22, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# add at risk facilities layer to fresh map\n", - "m2.add_layer(riskinfra)\n", + "m2.content.add(riskinfra)\n", " " ] }, @@ -938,7 +923,7 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": 6, "metadata": {}, "outputs": [ { @@ -954,9 +939,9 @@ "
\n", " LA County Infrastructure At Risk\n", " \n", - "
A Web Map with critical infrastructure at risk from fires.Web Map by api_data_owner\n", + "
A Web Map with critical infrastructure at risk from fires.
Web Map by api_data_owner\n", "
Last Modified: December 20, 2023\n", - "
0 comments, 5 views\n", + "
0 comments, 34 views\n", "
\n", "
\n", " " @@ -965,7 +950,7 @@ "" ] }, - "execution_count": 23, + "execution_count": 6, "metadata": {}, "output_type": "execute_result" } @@ -977,19 +962,19 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": 7, "metadata": { "scrolled": true }, "outputs": [], "source": [ - "# create a webmap from the item\n", - "webmap = arcgis.mapping.WebMap(webmapitem)" + "# create a web map from the item\n", + "webmap = gis.map(webmapitem)" ] }, { "cell_type": "code", - "execution_count": 25, + "execution_count": 8, "metadata": {}, "outputs": [ { @@ -1002,25 +987,22 @@ ], "source": [ "# read the operational layers in our webmap\n", - "for lyr in webmap.layers:\n", - " if lyr['id'].startswith('At_Risk_Infrastructure'):\n", - " print(lyr['url'])" + "for lyr in webmap.content.layers:\n", + " if webmap.content.layers[0].properties['name'].startswith('At_Risk_Infrastructure'):\n", + " print(lyr.url)" ] }, { "cell_type": "code", - "execution_count": 26, + "execution_count": null, "metadata": {}, "outputs": [ { - "data": { - "text/plain": [ - "'https://pythonapi.playground.esri.com/server/rest/services/Hosted/At_Risk_Infrastructure_2024_05_07_18_41_36/FeatureServer/0'" - ] - }, - "execution_count": 26, - "metadata": {}, - "output_type": "execute_result" + "name": "stdout", + "output_type": "stream", + "text": [ + "https://pythonapi.playground.esri.com/server/rest/services/Hosted/At_Risk_Infrastructure_2024_05_07_18_41_36/FeatureServer/0\n" + ] } ], "source": [ @@ -1030,15 +1012,15 @@ }, { "cell_type": "code", - "execution_count": 27, + "execution_count": 12, "metadata": {}, "outputs": [], "source": [ "# update the url of the 'At Risk Infrastructure' layer in the web map\n", "\n", - "for lyr in webmap.layers:\n", - " if lyr['id'].startswith('At_Risk_Infrastructure'):\n", - " lyr['url'] = new_url" + "for lyr in webmap.content.layers:\n", + " if webmap.content.layers[0].properties['name'].startswith('At_Risk_Infrastructure'):\n", + " lyr.url = new_url" ] }, { @@ -1060,17 +1042,9 @@ }, { "cell_type": "code", - "execution_count": 28, + "execution_count": null, "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n" - ] - } - ], + "outputs": [], "source": [ "m3 = gis.map('Los Angeles', 9)\n", "m3" @@ -1090,16 +1064,16 @@ }, { "cell_type": "code", - "execution_count": 29, + "execution_count": 9, "metadata": {}, "outputs": [], "source": [ - "feature_layer_id = webmap.layers[0].itemId" + "feature_layer_id = webmap.content.layers[0].properties['serviceItemId']" ] }, { "cell_type": "code", - "execution_count": 30, + "execution_count": 10, "metadata": {}, "outputs": [ { @@ -1115,9 +1089,9 @@ "
\n", " At_Risk_Infrastructure_source\n", " \n", - "
Feature Layer Collection by api_data_owner\n", + "

Feature Layer Collection by api_data_owner\n", "
Last Modified: December 19, 2023\n", - "
0 comments, 12 views\n", + "
0 comments, 39 views\n", "
\n", "
\n", " " @@ -1126,7 +1100,7 @@ "" ] }, - "execution_count": 30, + "execution_count": 10, "metadata": {}, "output_type": "execute_result" } @@ -1138,7 +1112,7 @@ }, { "cell_type": "code", - "execution_count": 31, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -1147,19 +1121,12 @@ }, { "cell_type": "code", - "execution_count": 32, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ - "m3.add_layer(featurelayer)" + "m3.content.add(featurelayer)" ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] } ], "metadata": { @@ -1183,7 +1150,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.5" + "version": "3.11.0" }, "toc": { "base_numbering": 1,