From 05de750c62b8ec7bd6b32293970816156d0be646 Mon Sep 17 00:00:00 2001 From: Manushi Majumdar Date: Tue, 19 Nov 2024 13:24:15 -0500 Subject: [PATCH 1/6] 2.4.0 changes to safe_streets_to_schools sample --- .../safe_streets_to_schools.ipynb | 841 +++++++++--------- 1 file changed, 425 insertions(+), 416 deletions(-) diff --git a/samples/04_gis_analysts_data_scientists/safe_streets_to_schools.ipynb b/samples/04_gis_analysts_data_scientists/safe_streets_to_schools.ipynb index 28b081571..6da703ec3 100644 --- a/samples/04_gis_analysts_data_scientists/safe_streets_to_schools.ipynb +++ b/samples/04_gis_analysts_data_scientists/safe_streets_to_schools.ipynb @@ -88,7 +88,7 @@ "\n", "from arcgis.gis import GIS\n", "from arcgis.features.analyze_patterns import calculate_density, find_hot_spots\n", - "from arcgis.mapping.symbol import create_symbol\n", + "from arcgis.map import renderers, symbols\n", "from arcgis.features.use_proximity import create_drive_time_areas\n", "from arcgis.features.summarize_data import summarize_within" ] @@ -104,7 +104,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Connect to the GIS via an existing profile or creating a new connection by e.g. gis = GIS(\"https://www.arcgis.com\", \"arcgis_python\", \"P@ssword123\")" + "Connect to the GIS via an existing profile or creating a new connection by e.g. gis = GIS(\"https://www.arcgis.com\", \"arcgis_python_123\", \"P@ssword123\")" ] }, { @@ -113,7 +113,7 @@ "metadata": {}, "outputs": [], "source": [ - "gis = GIS('home')" + "gis = GIS(profile='your_online_profile')" ] }, { @@ -149,17 +149,17 @@ "text/html": [ "
\n", "
\n", - " \n", + " \n", " \n", " \n", "
\n", "\n", "
\n", - " Traffic Collisions\n", + " Traffic Collisions\n", " \n", - "
Traffic collisions in Pasadena, California, since 2008.Feature Layer Collection by api_data_owner\n", - "
Last Modified: April 26, 2019\n", - "
0 comments, 24 views\n", + "
Traffic collisions in Pasadena, California, since 2008.
Feature Layer Collection by api_data_owner\n", + "
Last Modified: May 20, 2024\n", + "
0 comments, 7640 views\n", "
\n", "
\n", " " @@ -224,7 +224,7 @@ ], "source": [ "for lyr in item.layers:\n", - " print(lyr.properties.name)" + " print(lyr.properties['name'])" ] }, { @@ -245,25 +245,26 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 12, "metadata": {}, "outputs": [ { "data": { "text/html": [ - "" + "" ], "text/plain": [ "" ] }, - "execution_count": 8, + "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "m1 = gis.map('Pasadena, California', 13)\n", + "m1.basemap.basemap = 'topo-vector'\n", "m1" ] }, @@ -280,7 +281,7 @@ "metadata": {}, "outputs": [], "source": [ - "m1.add_layer(collisions)" + "m1.content.add(collisions)" ] }, { @@ -289,19 +290,19 @@ "metadata": {}, "outputs": [], "source": [ - "m1.legend = True" + "m1.legend.enabled = True" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "As the layer does not only contain information about location, but it also has other attributes that cannot be seen on map. So using `query` method, we can query the features on a feature layer. `sdf` property of `featureSet` class is a powerful tool to visualize all the features as Pandas `DataFrame`." + "The `collisions` layer does not only contain information about location, but it also has other attributes that cannot be seen on the map. So using `query` method, we can query the features of a feature layer. The `sdf` property of `featureSet` class is a powerful tool to visualize all the features as a Pandas `DataFrame`." ] }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 8, "metadata": {}, "outputs": [ { @@ -321,7 +322,7 @@ " dtype='object')" ] }, - "execution_count": 11, + "execution_count": 8, "metadata": {}, "output_type": "execute_result" } @@ -332,19 +333,23 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 9, "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "array(['Other Motor Vehicle', 'Pedestrian', 'Fixed Object', 'Bicycle',\n", - " 'Parked Motor Vehicle', 'Other Object',\n", - " 'Motor Vehicle on Other Roadway', 'Non-Collision', 'Train',\n", - " 'Animal', 'Not Stated', 'Other'], dtype=object)" + "\n", + "[ 'Other Motor Vehicle', 'Pedestrian',\n", + " 'Fixed Object', 'Bicycle',\n", + " 'Parked Motor Vehicle', 'Other Object',\n", + " 'Motor Vehicle on Other Roadway', 'Non-Collision',\n", + " 'Train', 'Animal',\n", + " 'Not Stated', 'Other']\n", + "Length: 12, dtype: string" ] }, - "execution_count": 12, + "execution_count": 9, "metadata": {}, "output_type": "execute_result" } @@ -362,7 +367,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 10, "metadata": {}, "outputs": [], "source": [ @@ -384,12 +389,12 @@ "\n", "Different ways to find patterns in data includes point clustering, heat maps, hot spot analysis and [calculate density](https://pro.arcgis.com/en/pro-app/tool-reference/spatial-analyst/how-kernel-density-works.htm). These methods reveal where accidents are happening at abnormal rates.\n", "\n", - "First, we will apply `calculate_density` tool to get better insights on data." + "First, we will apply `calculate_density` tool to get better insights of this data." ] }, { "cell_type": "code", - "execution_count": 14, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -399,7 +404,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 12, "metadata": {}, "outputs": [ { @@ -407,26 +412,26 @@ "text/html": [ "
\n", "
\n", - " \n", + " \n", " \n", " \n", "
\n", "\n", "
\n", - " density_of_incidents660540\n", + " density_of_incidents967701\n", " \n", - "
Feature Layer Collection by arcgis_python\n", - "
Last Modified: September 13, 2019\n", + "

Feature Layer Collection by MMajumdar_geosaurus\n", + "
Last Modified: November 14, 2024\n", "
0 comments, 0 views\n", "
\n", "
\n", " " ], "text/plain": [ - "" + "" ] }, - "execution_count": 15, + "execution_count": 12, "metadata": {}, "output_type": "execute_result" } @@ -437,27 +442,26 @@ }, { "cell_type": "code", - "execution_count": 16, - "metadata": { - "scrolled": false - }, + "execution_count": 24, + "metadata": {}, "outputs": [ { "data": { "text/html": [ - "" + "" ], "text/plain": [ "" ] }, - "execution_count": 16, + "execution_count": 24, "metadata": {}, "output_type": "execute_result" } ], "source": [ "m2 = gis.map('Pasadena, California', 13)\n", + "m2.basemap.basemap = 'topo-vector'\n", "m2" ] }, @@ -465,25 +469,34 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Areas with large number of accidents show up as more densely colored as compared to other areas." + "Areas with large number of accidents show up more densely colored as compared to other areas." ] }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 19, "metadata": {}, "outputs": [], "source": [ - "m2.add_layer(collision_density)" + "m2.content.add(collision_density)" ] }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 21, "metadata": {}, "outputs": [], "source": [ - "m2.legend = True" + "m2.zoom_to_layer(collision_density)" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "metadata": {}, + "outputs": [], + "source": [ + "m2.legend.enabled = True" ] }, { @@ -495,7 +508,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -506,36 +519,34 @@ }, { "cell_type": "code", - "execution_count": 20, - "metadata": { - "scrolled": true - }, + "execution_count": 14, + "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "
\n", - " \n", + " \n", " \n", " \n", "
\n", "\n", "
\n", - " collision_hexagon_hot_spots539052\n", + " collision_hexagon_hot_spots279247\n", " \n", - "
Feature Layer Collection by arcgis_python\n", - "
Last Modified: September 13, 2019\n", + "

Feature Layer Collection by MMajumdar_geosaurus\n", + "
Last Modified: November 14, 2024\n", "
0 comments, 0 views\n", "
\n", "
\n", " " ], "text/plain": [ - "" + "" ] }, - "execution_count": 20, + "execution_count": 14, "metadata": {}, "output_type": "execute_result" } @@ -546,27 +557,26 @@ }, { "cell_type": "code", - "execution_count": 21, - "metadata": { - "scrolled": false - }, + "execution_count": 35, + "metadata": {}, "outputs": [ { "data": { "text/html": [ - "" + "" ], "text/plain": [ "" ] }, - "execution_count": 21, + "execution_count": 35, "metadata": {}, "output_type": "execute_result" } ], "source": [ "m3 = gis.map('Pasadena, California', 13)\n", + "m3.basemap.basemap = 'arcgis-dark-gray'\n", "m3" ] }, @@ -579,20 +589,29 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": 32, + "metadata": {}, + "outputs": [], + "source": [ + "m3.content.add(collision_hot_spots)" + ] + }, + { + "cell_type": "code", + "execution_count": 33, "metadata": {}, "outputs": [], "source": [ - "m3.add_layer(collision_hot_spots)" + "m3.zoom_to_layer(collision_hot_spots)" ] }, { "cell_type": "code", - "execution_count": 23, + "execution_count": 34, "metadata": {}, "outputs": [], "source": [ - "m3.legend = True" + "m3.legend.enabled = True" ] }, { @@ -606,32 +625,31 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "We will use `HeatmapRenderer` to display generalized point pattern locations." + "We will use the Smart Mapping `HeatmapRenderer` to display generalized point pattern locations." ] }, { "cell_type": "code", - "execution_count": 24, - "metadata": { - "scrolled": false - }, + "execution_count": 40, + "metadata": {}, "outputs": [ { "data": { "text/html": [ - "" + "" ], "text/plain": [ "" ] }, - "execution_count": 24, + "execution_count": 40, "metadata": {}, "output_type": "execute_result" } ], "source": [ "m4 = gis.map('Pasadena, California', 13)\n", + "m4.basemap.basemap = 'topo-vector'\n", "m4" ] }, @@ -644,23 +662,30 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": 37, "metadata": {}, "outputs": [], "source": [ - "m4.add_layer({\"type\": \"FeatureLayer\",\n", - " \"url\": collisions.url, \n", - " \"renderer\": \"HeatmapRenderer\",\n", - " \"opacity\": 0.75})" + "m4.content.add(collisions, options={\"opacity\": 0.8})" ] }, { "cell_type": "code", - "execution_count": 26, + "execution_count": 38, "metadata": {}, "outputs": [], "source": [ - "m4.legend = True" + "sm_manager = m4.content.renderer(0).smart_mapping()\n", + "sm_manager.heatmap_renderer()" + ] + }, + { + "cell_type": "code", + "execution_count": 39, + "metadata": {}, + "outputs": [], + "source": [ + "m4.legend.enabled = True" ] }, { @@ -686,7 +711,7 @@ }, { "cell_type": "code", - "execution_count": 27, + "execution_count": 11, "metadata": { "scrolled": true }, @@ -697,7 +722,7 @@ }, { "cell_type": "code", - "execution_count": 28, + "execution_count": 12, "metadata": {}, "outputs": [], "source": [ @@ -706,7 +731,7 @@ }, { "cell_type": "code", - "execution_count": 29, + "execution_count": 13, "metadata": {}, "outputs": [ { @@ -755,7 +780,7 @@ " \n", " \n", " \n", - " 1\n", + " 1\n", " 2\n", " 10407211603116\n", " Other Hazardous Movement\n", @@ -776,10 +801,10 @@ " Clear\n", " 6517494\n", " 1875480\n", - " {'x': -13151952.7988482, 'y': 4048399.24990493...\n", + " {\"x\": -13151952.7988482, \"y\": 4048399.24990493...\n", " \n", " \n", - " 11\n", + " 11\n", " 12\n", " 10409075901001\n", " Auto R/W Violation\n", @@ -800,10 +825,10 @@ " Clear\n", " 6516612\n", " 1876820\n", - " {'x': -13152278.024718883, 'y': 4048894.055900...\n", + " {\"x\": -13152278.024718883, \"y\": 4048894.055900...\n", " \n", " \n", - " 26\n", + " 26\n", " 27\n", " 10411184701852\n", " Unsafe Speed\n", @@ -824,10 +849,10 @@ " Clear\n", " 6511556\n", " 1881787\n", - " {'x': -13154141.264326861, 'y': 4050727.197689...\n", + " {\"x\": -13154141.264326861, \"y\": 4050727.197689...\n", " \n", " \n", - " 29\n", + " 29\n", " 30\n", " 10412131002035\n", " Ped R/W Violation\n", @@ -848,10 +873,10 @@ " Clear\n", " 6517482\n", " 1879853\n", - " {'x': -13151959.551540626, 'y': 4050015.650237...\n", + " {\"x\": -13151959.551540626, \"y\": 4050015.650237...\n", " \n", " \n", - " 58\n", + " 58\n", " 59\n", " 10418170105652\n", " Other Hazardous Movement\n", @@ -872,11 +897,11 @@ " Clear\n", " 6525309.99742721\n", " 1885626.50722028\n", - " {'x': -13149081.688380858, 'y': 4052153.917797...\n", + " {\"x\": -13149081.688380858, \"y\": 4052153.917797...\n", " \n", " \n", "\n", - "

5 rows × 57 columns

\n", + "

5 rows × 57 columns

\n", "" ], "text/plain": [ @@ -909,16 +934,16 @@ "58 22517 Clear 6525309.99742721 1885626.50722028 \n", "\n", " SHAPE \n", - "1 {'x': -13151952.7988482, 'y': 4048399.24990493... \n", - "11 {'x': -13152278.024718883, 'y': 4048894.055900... \n", - "26 {'x': -13154141.264326861, 'y': 4050727.197689... \n", - "29 {'x': -13151959.551540626, 'y': 4050015.650237... \n", - "58 {'x': -13149081.688380858, 'y': 4052153.917797... \n", + "1 {\"x\": -13151952.7988482, \"y\": 4048399.24990493... \n", + "11 {\"x\": -13152278.024718883, \"y\": 4048894.055900... \n", + "26 {\"x\": -13154141.264326861, \"y\": 4050727.197689... \n", + "29 {\"x\": -13151959.551540626, \"y\": 4050015.650237... \n", + "58 {\"x\": -13149081.688380858, \"y\": 4052153.917797... \n", "\n", "[5 rows x 57 columns]" ] }, - "execution_count": 29, + "execution_count": 13, "metadata": {}, "output_type": "execute_result" } @@ -949,7 +974,7 @@ }, { "cell_type": "code", - "execution_count": 30, + "execution_count": 14, "metadata": {}, "outputs": [], "source": [ @@ -969,7 +994,7 @@ }, { "cell_type": "code", - "execution_count": 31, + "execution_count": 15, "metadata": {}, "outputs": [ { @@ -978,7 +1003,7 @@ "\"\\nvar acc_type = $feature.InvWith;\\nvar fatal = $feature.Nokilled;\\nvar injured = $feature.NoInjured;\\nvar result = When( \\n acc_type == 'Pedestrian' && fatal == '1' , 'PedestrianFatality',\\n acc_type == 'Pedestrian' && injured != '0', 'PedestrianInjury',\\n acc_type == 'Bicycle' && injured != '0', 'BicycleInjury',\\n acc_type == 'Bicycle' && fatal == '1', 'BicycleFatality',\\n 'null');\\nreturn result;\\n\"" ] }, - "execution_count": 31, + "execution_count": 15, "metadata": {}, "output_type": "execute_result" } @@ -996,18 +1021,21 @@ }, { "cell_type": "code", - "execution_count": 32, + "execution_count": 16, "metadata": {}, "outputs": [], "source": [ "def get_symbol(color, size):\n", - " return create_symbol(geometry_type='point',\n", - " symbol_type='simple',\n", - " symbol_style='o',\n", - " colors=color,\n", - " marker_size=size,\n", - " outline_style='s',\n", - " outline_color=[153,153,153,255], line_width=0.375)\n", + " outline = symbols.SimpleLineSymbolEsriSLS(\n", + " color=[153,153,153,255],\n", + " style=symbols.SimpleLineSymbolStyle.esri_sls_solid,\n", + " width=0.375)\n", + " symbol = symbols.SimpleMarkerSymbolEsriSMS(\n", + " color=color,\n", + " style = symbols.SimpleMarkerSymbolStyle.esri_sms_circle,\n", + " size=size,\n", + " outline=outline)\n", + " return symbol\n", "\n", "\n", "def get_unique_values(color_list, values):\n", @@ -1016,7 +1044,7 @@ }, { "cell_type": "code", - "execution_count": 33, + "execution_count": 17, "metadata": {}, "outputs": [], "source": [ @@ -1026,141 +1054,177 @@ "uv = get_unique_values(color_list, values)" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Let us take a look at the `uv` list that we built to generate unique values for the collision types. We will use this to build our custom `UniqueValueRenderer`." + ] + }, { "cell_type": "code", - "execution_count": 34, + "execution_count": 18, "metadata": {}, "outputs": [ { "data": { - "text/html": [ - "" - ], "text/plain": [ - "" + "[{'label': 'PedestrianFatality',\n", + " 'symbol': SimpleMarkerSymbolEsriSMS(angle=None, color=[255, 0, 0, 255], outline=SimpleLineSymbolEsriSLS(color=[153, 153, 153, 255], marker=None, style='esriSLSSolid', type='esriSLS', width=0.375), size=15, style='esriSMSCircle', type='esriSMS', xoffset=None, yoffset=None),\n", + " 'value': 'PedestrianFatality'},\n", + " {'label': 'PedestrianInjury',\n", + " 'symbol': SimpleMarkerSymbolEsriSMS(angle=None, color=[0, 255, 0, 255], outline=SimpleLineSymbolEsriSLS(color=[153, 153, 153, 255], marker=None, style='esriSLSSolid', type='esriSLS', width=0.375), size=3, style='esriSMSCircle', type='esriSMS', xoffset=None, yoffset=None),\n", + " 'value': 'PedestrianInjury'},\n", + " {'label': 'BicycleInjury',\n", + " 'symbol': SimpleMarkerSymbolEsriSMS(angle=None, color=[0, 0, 255, 255], outline=SimpleLineSymbolEsriSLS(color=[153, 153, 153, 255], marker=None, style='esriSLSSolid', type='esriSLS', width=0.375), size=3, style='esriSMSCircle', type='esriSMS', xoffset=None, yoffset=None),\n", + " 'value': 'BicycleInjury'},\n", + " {'label': 'BicycleFatality',\n", + " 'symbol': SimpleMarkerSymbolEsriSMS(angle=None, color=[0, 255, 255, 255], outline=SimpleLineSymbolEsriSLS(color=[153, 153, 153, 255], marker=None, style='esriSLSSolid', type='esriSLS', width=0.375), size=15, style='esriSMSCircle', type='esriSMS', xoffset=None, yoffset=None),\n", + " 'value': 'BicycleFatality'}]" ] }, - "execution_count": 34, + "execution_count": 18, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "m5 = gis.map('Pasadena, California', 13)\n", - "m5" + "uv" ] }, { - "cell_type": "markdown", + "cell_type": "code", + "execution_count": 19, "metadata": {}, + "outputs": [], "source": [ - "The fatalities receive a larger symbol size to indicate the difference in severity between injuries and fatalities." + "#Constructing UniqueValue details for the renderer\n", + "unique_value_list = []\n", + "for i in range(len(uv)):\n", + " category = {}\n", + " category['value'] = uv[i]['label']\n", + " category['label'] = uv[i]['label']\n", + " category['symbol'] = uv[i]['symbol']\n", + " unique_value_list.append(category)" ] }, { "cell_type": "code", - "execution_count": 35, + "execution_count": 20, + "metadata": {}, + "outputs": [], + "source": [ + "accident_renderer = renderers.UniqueValueRenderer(\n", + " valueExpression = arcade_expression,\n", + " unique_value_infos = unique_value_list)" + ] + }, + { + "cell_type": "code", + "execution_count": 24, "metadata": {}, "outputs": [ { "data": { + "text/html": [ + "" + ], "text/plain": [ - "True" + "" ] }, - "execution_count": 35, + "execution_count": 24, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "filtered_df.spatial.plot(map_widget=m5,\n", - " renderer_type='u-a',\n", - " unique_values=uv,\n", - " arcade_expression=arcade_expression)" + "m5 = gis.map('Pasadena, California')\n", + "m5.zoom = 13\n", + "m5.basemap.basemap = 'topo-vector'\n", + "m5" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "The fatalities receive a larger symbol size to indicate the difference in severity between injuries and fatalities." ] }, { "cell_type": "code", - "execution_count": 36, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ - "m5.legend = True" + "m5.content.add(filtered_df, drawing_info={\"renderer\": accident_renderer})" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "metadata": {}, + "outputs": [], + "source": [ + "m5.legend.enabled = True" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "The points are competing with the the basemap colors. So let's change the basemap to dark-gray." + "The points are blending in with the the basemap colors. So let's change the basemap to dark-gray." ] }, { "cell_type": "code", - "execution_count": 37, - "metadata": { - "scrolled": false - }, + "execution_count": 29, + "metadata": {}, "outputs": [ { "data": { "text/html": [ - "" + "" ], "text/plain": [ "" ] }, - "execution_count": 37, + "execution_count": 29, "metadata": {}, "output_type": "execute_result" } ], "source": [ "m6 = gis.map('Pasadena, California', 13)\n", + "m6.basemap.basemap = 'arcgis-dark-gray'\n", "m6" ] }, { - "cell_type": "markdown", + "cell_type": "code", + "execution_count": 27, "metadata": {}, + "outputs": [], "source": [ - "Now, the accidents stand out because the points are not competing with the basemap colors. There is also a clear distinction between bicycle and pedestrian accidents." + "m6.content.add(filtered_df, drawing_info={\"renderer\": accident_renderer})" ] }, { "cell_type": "code", - "execution_count": 38, - "metadata": { - "scrolled": true - }, + "execution_count": 28, + "metadata": {}, "outputs": [], "source": [ - "m6.basemap = 'dark-gray'" + "m6.legend.enabled = True" ] }, { - "cell_type": "code", - "execution_count": 39, + "cell_type": "markdown", "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "True" - ] - }, - "execution_count": 39, - "metadata": {}, - "output_type": "execute_result" - } - ], "source": [ - "filtered_df.spatial.plot(map_widget=m6,\n", - " renderer_type='u-a',\n", - " unique_values=uv,\n", - " arcade_expression=arcade_expression)" + "Now, the accidents stand out because the points are not competing with the basemap colors. There is also a clear distinction between bicycle and pedestrian accidents." ] }, { @@ -1179,16 +1243,16 @@ }, { "cell_type": "code", - "execution_count": 40, + "execution_count": 30, "metadata": {}, "outputs": [], "source": [ - "schools = gis.content.search('PUSD schools, owner:Learn_ArcGIS', 'Feature Layer',outside_org=True)[0]" + "schools = gis.content.search('PUSD schools, owner:Esri_Tutorials', 'Feature Layer',outside_org=True)[0]" ] }, { "cell_type": "code", - "execution_count": 41, + "execution_count": 31, "metadata": {}, "outputs": [ { @@ -1204,18 +1268,18 @@ "
\n", " PUSD Schools\n", " \n", - "
Schools in the Pasadena Unified School DistrictFeature Layer Collection by Learn_ArcGIS\n", - "
Last Modified: October 17, 2018\n", - "
0 comments, 7,643 views\n", + "
Schools in the Pasadena Unified School District
Feature Layer Collection by Esri_Tutorials\n", + "
Last Modified: October 14, 2024\n", + "
0 comments, 107443 views\n", "
\n", " \n", " " ], "text/plain": [ - "" + "" ] }, - "execution_count": 41, + "execution_count": 31, "metadata": {}, "output_type": "execute_result" } @@ -1228,114 +1292,99 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "By default, the schools have red point symbols that can be difficult to distinguish from the accident points. We'll change the symbol so the schools stand out more. The square shape will be distinguishable from the circle shapes of the accidents. We'll also change the color to white so the symbols stand out against the dark basemap." + "By default, the schools have red point symbols that can be difficult to distinguish from the accident points. We'll change the symbol so the schools stand out more. The square shape will be distinguishable from the circle shapes of the accidents. We'll also change the color to a light-gray so the symbols stand out against the dark basemap." ] }, { "cell_type": "code", - "execution_count": 42, + "execution_count": 38, "metadata": {}, "outputs": [ { "data": { "text/html": [ - "" + "" ], "text/plain": [ "" ] }, - "execution_count": 42, + "execution_count": 38, "metadata": {}, "output_type": "execute_result" } ], "source": [ "m7 = gis.map('Pasadena, California', 13)\n", + "m7.basemap.basemap = 'arcgis-dark-gray'\n", "m7" ] }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "The layer of schools is added to the map. The schools now stand out and can be distinguished from the accidents." - ] - }, { "cell_type": "code", - "execution_count": 43, + "execution_count": 33, "metadata": {}, "outputs": [], "source": [ - "m7_renderer = {\"renderer\": \"autocast\",\n", - " \"type\": \"simple\"}\n", - "def get_symbol(color):\n", - " return create_symbol(geometry_type='point',\n", - " symbol_type='simple',\n", - " symbol_style='s',\n", - " colors=color,\n", - " marker_size=13,\n", - " outline_style='s',\n", - " outline_color=[153,153,153,255],\n", - " line_width=0.375)\n", - "\n", - "symbol = get_symbol([153,153,153,255])\n", - "m7_renderer['symbol'] = symbol" + "def get_symbol(color, size):\n", + " outline = symbols.SimpleLineSymbolEsriSLS(\n", + " color=[153,153,153,255],\n", + " style=symbols.SimpleLineSymbolStyle.esri_sls_solid,\n", + " width=0.375)\n", + " symbol = symbols.SimpleMarkerSymbolEsriSMS(\n", + " color=color,\n", + " style = symbols.SimpleMarkerSymbolStyle.esri_sms_circle,\n", + " size=size,\n", + " outline=outline)\n", + " return symbol" ] }, { "cell_type": "code", - "execution_count": 44, + "execution_count": 34, "metadata": {}, "outputs": [], "source": [ - "m7.basemap = 'dark-gray'" + "outline = symbols.SimpleLineSymbolEsriSLS(\n", + " color=[153,153,153,255],\n", + " style=symbols.SimpleLineSymbolStyle.esri_sls_solid,\n", + " width=0.375)\n", + "\n", + "school_renderer = renderers.SimpleRenderer(\n", + " symbol = symbols.SimpleMarkerSymbolEsriSMS(\n", + " color = [153,153,153,255],\n", + " style = symbols.SimpleMarkerSymbolStyle.esri_sms_square,\n", + " size = 13,\n", + " outline = outline\n", + " )\n", + ")\n", + " " ] }, { "cell_type": "code", - "execution_count": 45, + "execution_count": 36, "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "True" - ] - }, - "execution_count": 45, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ - "filtered_df.spatial.plot(map_widget=m7,\n", - " renderer_type='u-a',\n", - " unique_values=uv,\n", - " arcade_expression=arcade_expression)" + "m7.content.add(filtered_df, drawing_info={\"renderer\": accident_renderer})\n", + "m7.content.add(schools.layers[0], drawing_info={\"renderer\": school_renderer})" ] }, { "cell_type": "code", - "execution_count": 46, + "execution_count": 37, "metadata": {}, "outputs": [], "source": [ - "m7.add_layer({ \"type\": \"FeatureLayer\",\n", - " \"url\": schools.layers[0].url,\n", - " \"transparency\": 75,\n", - " \"renderer\": m7_renderer\n", - " })\n" + "m7.legend.enabled = True" ] }, { - "cell_type": "code", - "execution_count": 47, + "cell_type": "markdown", "metadata": {}, - "outputs": [], "source": [ - "m7.legend = True" + "The layer of schools is added to the map. The schools now stand out and can be distinguished from the accidents." ] }, { @@ -1356,7 +1405,7 @@ }, { "cell_type": "code", - "execution_count": 48, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -1369,36 +1418,34 @@ }, { "cell_type": "code", - "execution_count": 49, - "metadata": { - "scrolled": true - }, + "execution_count": 40, + "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "
\n", - " \n", + " \n", " \n", " \n", "
\n", "\n", "
\n", - " psud_schools_drivetime224021\n", + " psud_schools_drivetime804991\n", " \n", - "
Feature Layer Collection by arcgis_python\n", - "
Last Modified: September 13, 2019\n", - "
0 comments, 0 views\n", + "

Feature Layer Collection by MMajumdar_geosaurus\n", + "
Last Modified: November 19, 2024\n", + "
0 comments, 1 views\n", "
\n", "
\n", " " ], "text/plain": [ - "" + "" ] }, - "execution_count": 49, + "execution_count": 40, "metadata": {}, "output_type": "execute_result" } @@ -1409,27 +1456,26 @@ }, { "cell_type": "code", - "execution_count": 50, - "metadata": { - "scrolled": false - }, + "execution_count": 47, + "metadata": {}, "outputs": [ { "data": { "text/html": [ - "" + "" ], "text/plain": [ "" ] }, - "execution_count": 50, + "execution_count": 47, "metadata": {}, "output_type": "execute_result" } ], "source": [ "m8 = gis.map('Pasadena, California', 13)\n", + "m8.basemap.basemap = 'arcgis-dark-gray'\n", "m8" ] }, @@ -1442,74 +1488,39 @@ }, { "cell_type": "code", - "execution_count": 51, - "metadata": {}, - "outputs": [], - "source": [ - "m8.basemap = 'dark-gray'" - ] - }, - { - "cell_type": "code", - "execution_count": 52, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "True" - ] - }, - "execution_count": 52, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "filtered_df.spatial.plot(map_widget=m8,\n", - " renderer_type='u-a',\n", - " unique_values=uv,\n", - " arcade_expression=arcade_expression)" - ] - }, - { - "cell_type": "code", - "execution_count": 53, + "execution_count": 44, "metadata": {}, "outputs": [], "source": [ - "m8.add_layer({ \"type\": \"FeatureLayer\",\n", - " \"url\": schools.layers[0].url,\n", - " \"transparency\": 75,\n", - " \"renderer\": m7_renderer\n", - " })\n" + "m8.content.add(filtered_df, drawing_info={\"renderer\": accident_renderer})\n", + "m8.content.add(schools.layers[0], drawing_info={\"renderer\": school_renderer})" ] }, { "cell_type": "code", - "execution_count": 54, + "execution_count": 45, "metadata": {}, "outputs": [], "source": [ - "m8.add_layer(walk_dist_from_schools)" + "m8.content.add(walk_dist_from_schools, options={\"opacity\": 0.6})" ] }, { "cell_type": "code", - "execution_count": 55, + "execution_count": 46, "metadata": {}, "outputs": [], "source": [ - "m8.legend = True" + "m8.legend.enabled = True" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "We could stop your analysis here, and use this map as grounds to implement a policy that encompasses all school zones. Changing street signs and adding bicycle lanes in these areas may reduce accidents near schools.\n", + "You could stop your analysis here, and use this map as grounds to implement a policy that encompasses all school zones. Changing street signs and adding bicycle lanes in these areas may reduce accidents near schools.\n", "\n", - "However, sometimes a city does not have enough funds to enact new policy for every location. Many Pasadena school zones have few accidents, so policies in these areas may have little effect. Instead, policymakers want to focus their efforts on areas that need it most.\n", + "However, sometimes a city does not have enough funds to enact new policy for every location. Many Pasadena school zones have few accidents, so policies in these areas may have little effect. Instead, policymakers want to focus their efforts on areas that need it the most.\n", "\n", "We'll calculate the number of accidents within each school zone and filter the layer to show only the five most dangerous zones. Then, policymakers can prioritize these zones over zones that are already relatively safe." ] @@ -1530,7 +1541,7 @@ }, { "cell_type": "code", - "execution_count": 56, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -1541,7 +1552,7 @@ }, { "cell_type": "code", - "execution_count": 57, + "execution_count": 49, "metadata": {}, "outputs": [ { @@ -1549,26 +1560,26 @@ "text/html": [ "
\n", "
\n", - " \n", + " \n", " \n", " \n", "
\n", "\n", "
\n", - " accident_count_within_school_zone169811\n", + " accident_count_within_school_zone185097\n", " \n", - "
Feature Layer Collection by arcgis_python\n", - "
Last Modified: September 13, 2019\n", + "

Feature Layer Collection by MMajumdar_geosaurus\n", + "
Last Modified: November 19, 2024\n", "
0 comments, 0 views\n", "
\n", "
\n", " " ], "text/plain": [ - "" + "" ] }, - "execution_count": 57, + "execution_count": 49, "metadata": {}, "output_type": "execute_result" } @@ -1579,7 +1590,7 @@ }, { "cell_type": "code", - "execution_count": 58, + "execution_count": 50, "metadata": {}, "outputs": [], "source": [ @@ -1588,7 +1599,7 @@ }, { "cell_type": "code", - "execution_count": 59, + "execution_count": 54, "metadata": {}, "outputs": [ { @@ -1613,7 +1624,6 @@ " \n", " \n", " OBJECTID\n", - " Point_Count\n", " Name\n", " FromBreak\n", " ToBreak\n", @@ -1626,197 +1636,207 @@ " AdditionalTime\n", " AdditionalDistance\n", " AnalysisArea\n", + " Point_Count\n", " SHAPE\n", " \n", " \n", " \n", " \n", - " 10\n", - " 11\n", - " 110\n", + " 7\n", + " 8\n", + " Madison Elementary : 0 - 0.5\n", + " 0.0\n", + " 0.5\n", + " 8\n", + " Madison Elementary\n", + " 515 ASHTABULA ST\n", + " PASADENA\n", + " ELEMENTARY\n", + " <NA>\n", + " 0.0\n", + " 0.0\n", + " 0.529728\n", + " 117\n", + " {\"rings\": [[[-13151389.2187, 4051086.8635], [-...\n", + " \n", + " \n", + " 8\n", + " 9\n", " McKinley School : 0 - 0.5\n", - " 0\n", + " 0.0\n", " 0.5\n", " 9\n", " McKinley School\n", " 325 S OAK KNOLL AVE\n", " PASADENA\n", " ELEMENTARY/MIDDLE\n", - " None\n", - " 0\n", - " 0\n", - " 1.492772\n", - " {'rings': [[[-13150773.7838, 4048681.8554], [-...\n", + " <NA>\n", + " 0.0\n", + " 0.0\n", + " 0.61083\n", + " 114\n", + " {\"rings\": [[[-13150764.2216, 4048700.1758], [-...\n", " \n", " \n", - " 11\n", - " 12\n", - " 106\n", + " 19\n", + " 20\n", " Rose City High Alternative : 0 - 0.5\n", - " 0\n", + " 0.0\n", " 0.5\n", " 20\n", " Rose City High Alternative\n", " 351 S HUDSON AVE\n", " PASADENA\n", " HIGH\n", - " None\n", - " 0\n", - " 0\n", - " 1.355013\n", - " {'rings': [[[-13150623.7846, 4048651.6474], [-...\n", + " <NA>\n", + " 0.0\n", + " 0.0\n", + " 0.502756\n", + " 84\n", + " {\"rings\": [[[-13150764.2216, 4048549.1365], [-...\n", " \n", " \n", - " 14\n", - " 15\n", - " 104\n", - " Madison Elementary : 0 - 0.5\n", - " 0\n", + " 10\n", + " 11\n", + " Washington Accelerated Elementary : 0 - 0.5\n", + " 0.0\n", " 0.5\n", - " 8\n", - " Madison Elementary\n", - " 515 ASHTABULA ST\n", + " 11\n", + " Washington Accelerated Elementary\n", + " 1520 N RAYMOND AVE\n", " PASADENA\n", " ELEMENTARY\n", - " None\n", - " 0\n", - " 0\n", - " 1.273972\n", - " {'rings': [[[-13151398.781, 4051098.7538], [-1...\n", + " <NA>\n", + " 0.0\n", + " 0.0\n", + " 0.572369\n", + " 64\n", + " {\"rings\": [[[-13152314.2145, 4052990.531], [-1...\n", " \n", " \n", + " 6\n", " 7\n", - " 8\n", - " 63\n", - " Washington Middle : 0 - 0.5\n", - " 0\n", - " 0.5\n", - " 18\n", - " Washington Middle\n", - " 1505 N MARENGO AVE\n", - " PASADENA\n", - " MIDDLE\n", - " None\n", - " 0\n", - " 0\n", - " 1.292630\n", - " {'rings': [[[-13151998.7782, 4052730.4508], [-...\n", - " \n", - " \n", - " 16\n", - " 17\n", - " 62\n", " Longfellow Elementary : 0 - 0.5\n", - " 0\n", + " 0.0\n", " 0.5\n", " 7\n", " Longfellow Elementary\n", " 1065 E WASHINGTON BLVD\n", " PASADENA\n", " ELEMENTARY\n", - " None\n", - " 0\n", - " 0\n", - " 1.418004\n", - " {'rings': [[[-13149873.788, 4052398.0492], [-1...\n", + " <NA>\n", + " 0.0\n", + " 0.0\n", + " 0.57478\n", + " 61\n", + " {\"rings\": [[[-13149814.2259, 4052416.3755], [-...\n", " \n", " \n", "\n", "" ], "text/plain": [ - " OBJECTID Point_Count Name FromBreak \\\n", - "10 11 110 McKinley School : 0 - 0.5 0 \n", - "11 12 106 Rose City High Alternative : 0 - 0.5 0 \n", - "14 15 104 Madison Elementary : 0 - 0.5 0 \n", - "7 8 63 Washington Middle : 0 - 0.5 0 \n", - "16 17 62 Longfellow Elementary : 0 - 0.5 0 \n", + " OBJECTID Name FromBreak ToBreak \\\n", + "7 8 Madison Elementary : 0 - 0.5 0.0 0.5 \n", + "8 9 McKinley School : 0 - 0.5 0.0 0.5 \n", + "19 20 Rose City High Alternative : 0 - 0.5 0.0 0.5 \n", + "10 11 Washington Accelerated Elementary : 0 - 0.5 0.0 0.5 \n", + "6 7 Longfellow Elementary : 0 - 0.5 0.0 0.5 \n", "\n", - " ToBreak FacilityOID Name_1 ADDRESS \\\n", - "10 0.5 9 McKinley School 325 S OAK KNOLL AVE \n", - "11 0.5 20 Rose City High Alternative 351 S HUDSON AVE \n", - "14 0.5 8 Madison Elementary 515 ASHTABULA ST \n", - "7 0.5 18 Washington Middle 1505 N MARENGO AVE \n", - "16 0.5 7 Longfellow Elementary 1065 E WASHINGTON BLVD \n", + " FacilityOID Name_1 ADDRESS \\\n", + "7 8 Madison Elementary 515 ASHTABULA ST \n", + "8 9 McKinley School 325 S OAK KNOLL AVE \n", + "19 20 Rose City High Alternative 351 S HUDSON AVE \n", + "10 11 Washington Accelerated Elementary 1520 N RAYMOND AVE \n", + "6 7 Longfellow Elementary 1065 E WASHINGTON BLVD \n", "\n", " CITY SCHOOLTYPE Breaks AdditionalTime AdditionalDistance \\\n", - "10 PASADENA ELEMENTARY/MIDDLE None 0 0 \n", - "11 PASADENA HIGH None 0 0 \n", - "14 PASADENA ELEMENTARY None 0 0 \n", - "7 PASADENA MIDDLE None 0 0 \n", - "16 PASADENA ELEMENTARY None 0 0 \n", + "7 PASADENA ELEMENTARY 0.0 0.0 \n", + "8 PASADENA ELEMENTARY/MIDDLE 0.0 0.0 \n", + "19 PASADENA HIGH 0.0 0.0 \n", + "10 PASADENA ELEMENTARY 0.0 0.0 \n", + "6 PASADENA ELEMENTARY 0.0 0.0 \n", "\n", - " AnalysisArea SHAPE \n", - "10 1.492772 {'rings': [[[-13150773.7838, 4048681.8554], [-... \n", - "11 1.355013 {'rings': [[[-13150623.7846, 4048651.6474], [-... \n", - "14 1.273972 {'rings': [[[-13151398.781, 4051098.7538], [-1... \n", - "7 1.292630 {'rings': [[[-13151998.7782, 4052730.4508], [-... \n", - "16 1.418004 {'rings': [[[-13149873.788, 4052398.0492], [-1... " + " AnalysisArea Point_Count \\\n", + "7 0.529728 117 \n", + "8 0.61083 114 \n", + "19 0.502756 84 \n", + "10 0.572369 64 \n", + "6 0.57478 61 \n", + "\n", + " SHAPE \n", + "7 {\"rings\": [[[-13151389.2187, 4051086.8635], [-... \n", + "8 {\"rings\": [[[-13150764.2216, 4048700.1758], [-... \n", + "19 {\"rings\": [[[-13150764.2216, 4048549.1365], [-... \n", + "10 {\"rings\": [[[-13152314.2145, 4052990.531], [-1... \n", + "6 {\"rings\": [[[-13149814.2259, 4052416.3755], [-... " ] }, - "execution_count": 59, + "execution_count": 54, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "top_5_dangerous_areas[:5]" + "top_5_dangerous_areas_df = top_5_dangerous_areas[:5]\n", + "top_5_dangerous_areas_df" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "The table is sorted so that school zones with more accidents are shown first. The first five school zones have accidents totaling 109, 106, 104, 63, and 62, respectively.\n", + "The table is sorted so that school zones with more accidents are shown first. The first five school zones have accidents totaling 117, 114, 84, 64, and 61, respectively.\n", "\n", - "The sixth-highest school zone has 59 accidents, which is almost the same as the fifth highest. With this information, you might consider expanding policy to include this school zone as well. Alternatively, depending on the city's resources, we want to limit policy to focus only on the three most dangerous school zones, which have a much higher number of accidents than the fourth.\n", + "The sixth-highest school zone has 58 accidents, which is almost the same as the fifth highest. With this information, you might consider expanding policy to include this school zone as well. Alternatively, depending on the city's resources, we want to limit policy to focus only on the three most dangerous school zones, which have a much higher number of accidents than the fourth.\n", "\n", "For this scenario, we'll continue to focus on the five most dangerous school zones. We'll filter the layer to show only these zones." ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "All five of the most dangerous school zones are relatively close to one another. Two of the most dangerous zones almost overlap entirely, which means the city can increase safety for both schools with many of the same policy decisions." + ] + }, { "cell_type": "code", - "execution_count": 60, + "execution_count": 66, "metadata": {}, "outputs": [ { "data": { "text/html": [ - "" + "" ], "text/plain": [ "" ] }, - "execution_count": 60, + "execution_count": 66, "metadata": {}, "output_type": "execute_result" } ], "source": [ "m9 = gis.map('Pasadena, California', 13)\n", + "m9.basemap.basemap = 'arcgis-dark-gray'\n", "m9" ] }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "All five of the most dangerous school zones are relatively close to one another. Two of the most dangerous zones almost overlap entirely, which means the city can increase safety for both schools with many of the same policy decisions." - ] - }, { "cell_type": "code", - "execution_count": 61, + "execution_count": 59, "metadata": {}, "outputs": [], "source": [ - "m9.basemap = 'dark-gray'" + "m9.content.add(filtered_df, drawing_info={\"renderer\": accident_renderer})" ] }, { "cell_type": "code", - "execution_count": 62, + "execution_count": 60, "metadata": {}, "outputs": [ { @@ -1825,42 +1845,31 @@ "True" ] }, - "execution_count": 62, + "execution_count": 60, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "filtered_df.spatial.plot(map_widget=m9,\n", - " renderer_type='u-a',\n", - " unique_values=uv,\n", - " arcade_expression=arcade_expression)" + "top_5_dangerous_areas_df.spatial.plot(map_widget = m9)" ] }, { "cell_type": "code", - "execution_count": 63, + "execution_count": 61, "metadata": {}, "outputs": [], "source": [ - "m9.add_layer({\"type\": \"FeatureLayer\", \n", - " \"url\": dangerous_areas.layers[0].url,\n", - " \"definition_expression\" : \"Point_Count>=61\",\n", - " \"opacity\": 0.7\n", - " })" + "m9.content.add(schools.layers[0], drawing_info={\"renderer\": school_renderer})" ] }, { "cell_type": "code", - "execution_count": 64, + "execution_count": 65, "metadata": {}, "outputs": [], "source": [ - "m9.add_layer({ \"type\": \"FeatureLayer\",\n", - " \"url\": schools.layers[0].url,\n", - " \"transparency\": 75,\n", - " \"renderer\": m7_renderer\n", - " })\n" + "m9.zoom_to_layer(schools.layers[0])" ] }, { @@ -1874,7 +1883,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "We've created a map that highlights five school zones that would benefit from policy intervention. \n", + "We have created a map that highlights five school zones that would benefit from policy intervention. \n", "The city officials can now identify the most dangerous school zones in order to reduce the likelihood of future accidents." ] } @@ -1885,7 +1894,7 @@ "notebookRuntimeVersion": "9.0" }, "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -1899,9 +1908,9 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.7.9" + "version": "3.11.10" } }, "nbformat": 4, - "nbformat_minor": 2 + "nbformat_minor": 4 } From 86fd19442e17ec06a419e1eea3a62e53609f77ce Mon Sep 17 00:00:00 2001 From: Manushi Majumdar Date: Wed, 20 Nov 2024 12:48:13 -0500 Subject: [PATCH 2/6] requested changes --- .../safe_streets_to_schools.ipynb | 74 +++++++------------ 1 file changed, 26 insertions(+), 48 deletions(-) diff --git a/samples/04_gis_analysts_data_scientists/safe_streets_to_schools.ipynb b/samples/04_gis_analysts_data_scientists/safe_streets_to_schools.ipynb index 6da703ec3..1c1916c21 100644 --- a/samples/04_gis_analysts_data_scientists/safe_streets_to_schools.ipynb +++ b/samples/04_gis_analysts_data_scientists/safe_streets_to_schools.ipynb @@ -263,7 +263,8 @@ } ], "source": [ - "m1 = gis.map('Pasadena, California', 13)\n", + "m1 = gis.map('Pasadena, California')\n", + "m1.zoomlevel = 13\n", "m1.basemap.basemap = 'topo-vector'\n", "m1" ] @@ -460,7 +461,8 @@ } ], "source": [ - "m2 = gis.map('Pasadena, California', 13)\n", + "m2 = gis.map('Pasadena, California')\n", + "m2.zoomlevel = 13\n", "m2.basemap.basemap = 'topo-vector'\n", "m2" ] @@ -575,7 +577,8 @@ } ], "source": [ - "m3 = gis.map('Pasadena, California', 13)\n", + "m3 = gis.map('Pasadena, California')\n", + "m3.zoomlevel = 13\n", "m3.basemap.basemap = 'arcgis-dark-gray'\n", "m3" ] @@ -648,7 +651,8 @@ } ], "source": [ - "m4 = gis.map('Pasadena, California', 13)\n", + "m4 = gis.map('Pasadena, California')\n", + "m4.zoomlevel = 13\n", "m4.basemap.basemap = 'topo-vector'\n", "m4" ] @@ -1051,61 +1055,31 @@ "color_list = [ [255, 0, 0, 255], [0, 255, 0, 255], [0, 0, 255, 255], [0 , 255, 255, 255] ] \n", "values = ['PedestrianFatality', 'PedestrianInjury', 'BicycleInjury', 'BicycleFatality']\n", "sizes = [15, 3, 3, 15]\n", - "uv = get_unique_values(color_list, values)" + "unique_value_list = get_unique_values(color_list, values)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "Let us take a look at the `uv` list that we built to generate unique values for the collision types. We will use this to build our custom `UniqueValueRenderer`." + "Let us take a look at the `unique_value_list` list that we built to generate unique values for the collision types. We will use this to build our custom `UniqueValueRenderer`." ] }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 71, "metadata": {}, "outputs": [ { - "data": { - "text/plain": [ - "[{'label': 'PedestrianFatality',\n", - " 'symbol': SimpleMarkerSymbolEsriSMS(angle=None, color=[255, 0, 0, 255], outline=SimpleLineSymbolEsriSLS(color=[153, 153, 153, 255], marker=None, style='esriSLSSolid', type='esriSLS', width=0.375), size=15, style='esriSMSCircle', type='esriSMS', xoffset=None, yoffset=None),\n", - " 'value': 'PedestrianFatality'},\n", - " {'label': 'PedestrianInjury',\n", - " 'symbol': SimpleMarkerSymbolEsriSMS(angle=None, color=[0, 255, 0, 255], outline=SimpleLineSymbolEsriSLS(color=[153, 153, 153, 255], marker=None, style='esriSLSSolid', type='esriSLS', width=0.375), size=3, style='esriSMSCircle', type='esriSMS', xoffset=None, yoffset=None),\n", - " 'value': 'PedestrianInjury'},\n", - " {'label': 'BicycleInjury',\n", - " 'symbol': SimpleMarkerSymbolEsriSMS(angle=None, color=[0, 0, 255, 255], outline=SimpleLineSymbolEsriSLS(color=[153, 153, 153, 255], marker=None, style='esriSLSSolid', type='esriSLS', width=0.375), size=3, style='esriSMSCircle', type='esriSMS', xoffset=None, yoffset=None),\n", - " 'value': 'BicycleInjury'},\n", - " {'label': 'BicycleFatality',\n", - " 'symbol': SimpleMarkerSymbolEsriSMS(angle=None, color=[0, 255, 255, 255], outline=SimpleLineSymbolEsriSLS(color=[153, 153, 153, 255], marker=None, style='esriSLSSolid', type='esriSLS', width=0.375), size=15, style='esriSMSCircle', type='esriSMS', xoffset=None, yoffset=None),\n", - " 'value': 'BicycleFatality'}]" - ] - }, - "execution_count": 18, - "metadata": {}, - "output_type": "execute_result" + "name": "stdout", + "output_type": "stream", + "text": [ + "[{'value': 'PedestrianFatality', 'label': 'PedestrianFatality', 'symbol': SimpleMarkerSymbolEsriSMS(angle=None, color=[255, 0, 0, 255], outline=SimpleLineSymbolEsriSLS(color=[153, 153, 153, 255], marker=None, style='esriSLSSolid', type='esriSLS', width=0.375), size=15, style='esriSMSCircle', type='esriSMS', xoffset=None, yoffset=None)}, {'value': 'PedestrianInjury', 'label': 'PedestrianInjury', 'symbol': SimpleMarkerSymbolEsriSMS(angle=None, color=[0, 255, 0, 255], outline=SimpleLineSymbolEsriSLS(color=[153, 153, 153, 255], marker=None, style='esriSLSSolid', type='esriSLS', width=0.375), size=3, style='esriSMSCircle', type='esriSMS', xoffset=None, yoffset=None)}, {'value': 'BicycleInjury', 'label': 'BicycleInjury', 'symbol': SimpleMarkerSymbolEsriSMS(angle=None, color=[0, 0, 255, 255], outline=SimpleLineSymbolEsriSLS(color=[153, 153, 153, 255], marker=None, style='esriSLSSolid', type='esriSLS', width=0.375), size=3, style='esriSMSCircle', type='esriSMS', xoffset=None, yoffset=None)}, {'value': 'BicycleFatality', 'label': 'BicycleFatality', 'symbol': SimpleMarkerSymbolEsriSMS(angle=None, color=[0, 255, 255, 255], outline=SimpleLineSymbolEsriSLS(color=[153, 153, 153, 255], marker=None, style='esriSLSSolid', type='esriSLS', width=0.375), size=15, style='esriSMSCircle', type='esriSMS', xoffset=None, yoffset=None)}]\n" + ] } ], "source": [ - "uv" - ] - }, - { - "cell_type": "code", - "execution_count": 19, - "metadata": {}, - "outputs": [], - "source": [ - "#Constructing UniqueValue details for the renderer\n", - "unique_value_list = []\n", - "for i in range(len(uv)):\n", - " category = {}\n", - " category['value'] = uv[i]['label']\n", - " category['label'] = uv[i]['label']\n", - " category['symbol'] = uv[i]['symbol']\n", - " unique_value_list.append(category)" + "print(unique_value_list)" ] }, { @@ -1140,7 +1114,7 @@ ], "source": [ "m5 = gis.map('Pasadena, California')\n", - "m5.zoom = 13\n", + "m5.zoomlevel = 13\n", "m5.basemap.basemap = 'topo-vector'\n", "m5" ] @@ -1197,7 +1171,8 @@ } ], "source": [ - "m6 = gis.map('Pasadena, California', 13)\n", + "m6 = gis.map('Pasadena, California')\n", + "m6.zoomlevel = 13\n", "m6.basemap.basemap = 'arcgis-dark-gray'\n", "m6" ] @@ -1315,7 +1290,8 @@ } ], "source": [ - "m7 = gis.map('Pasadena, California', 13)\n", + "m7 = gis.map('Pasadena, California')\n", + "m7.zoomlevel = 13\n", "m7.basemap.basemap = 'arcgis-dark-gray'\n", "m7" ] @@ -1474,7 +1450,8 @@ } ], "source": [ - "m8 = gis.map('Pasadena, California', 13)\n", + "m8 = gis.map('Pasadena, California')\n", + "m8.zoomlevel = 13\n", "m8.basemap.basemap = 'arcgis-dark-gray'\n", "m8" ] @@ -1820,7 +1797,8 @@ } ], "source": [ - "m9 = gis.map('Pasadena, California', 13)\n", + "m9 = gis.map('Pasadena, California')\n", + "m9.zoomlevel = 13\n", "m9.basemap.basemap = 'arcgis-dark-gray'\n", "m9" ] From 84d737638473ac3daba06731656b5545dc97728c Mon Sep 17 00:00:00 2001 From: Manushi Majumdar Date: Wed, 20 Nov 2024 14:23:33 -0500 Subject: [PATCH 3/6] changes to zoom --- .../safe_streets_to_schools.ipynb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/samples/04_gis_analysts_data_scientists/safe_streets_to_schools.ipynb b/samples/04_gis_analysts_data_scientists/safe_streets_to_schools.ipynb index 1c1916c21..971e5f137 100644 --- a/samples/04_gis_analysts_data_scientists/safe_streets_to_schools.ipynb +++ b/samples/04_gis_analysts_data_scientists/safe_streets_to_schools.ipynb @@ -264,7 +264,7 @@ ], "source": [ "m1 = gis.map('Pasadena, California')\n", - "m1.zoomlevel = 13\n", + "m1.zoom = 13\n", "m1.basemap.basemap = 'topo-vector'\n", "m1" ] @@ -462,7 +462,7 @@ ], "source": [ "m2 = gis.map('Pasadena, California')\n", - "m2.zoomlevel = 13\n", + "m2.zoom = 13\n", "m2.basemap.basemap = 'topo-vector'\n", "m2" ] @@ -652,7 +652,7 @@ ], "source": [ "m4 = gis.map('Pasadena, California')\n", - "m4.zoomlevel = 13\n", + "m4.zoom = 13\n", "m4.basemap.basemap = 'topo-vector'\n", "m4" ] @@ -1114,7 +1114,7 @@ ], "source": [ "m5 = gis.map('Pasadena, California')\n", - "m5.zoomlevel = 13\n", + "m5.zoom = 13\n", "m5.basemap.basemap = 'topo-vector'\n", "m5" ] @@ -1172,7 +1172,7 @@ ], "source": [ "m6 = gis.map('Pasadena, California')\n", - "m6.zoomlevel = 13\n", + "m6.zoom = 13\n", "m6.basemap.basemap = 'arcgis-dark-gray'\n", "m6" ] @@ -1291,7 +1291,7 @@ ], "source": [ "m7 = gis.map('Pasadena, California')\n", - "m7.zoomlevel = 13\n", + "m7.zoom = 13\n", "m7.basemap.basemap = 'arcgis-dark-gray'\n", "m7" ] @@ -1451,7 +1451,7 @@ ], "source": [ "m8 = gis.map('Pasadena, California')\n", - "m8.zoomlevel = 13\n", + "m8.zoom = 13\n", "m8.basemap.basemap = 'arcgis-dark-gray'\n", "m8" ] @@ -1798,7 +1798,7 @@ ], "source": [ "m9 = gis.map('Pasadena, California')\n", - "m9.zoomlevel = 13\n", + "m9.zoom = 13\n", "m9.basemap.basemap = 'arcgis-dark-gray'\n", "m9" ] From 9ac3d5deb1320d4d9a2c85acdcda9ae92c3066a4 Mon Sep 17 00:00:00 2001 From: Manushi Majumdar Date: Wed, 27 Nov 2024 12:20:58 -0500 Subject: [PATCH 4/6] map changes to zoom --- .../safe_streets_to_schools.ipynb | 189 +++++++++--------- 1 file changed, 100 insertions(+), 89 deletions(-) diff --git a/samples/04_gis_analysts_data_scientists/safe_streets_to_schools.ipynb b/samples/04_gis_analysts_data_scientists/safe_streets_to_schools.ipynb index 971e5f137..23c19a41b 100644 --- a/samples/04_gis_analysts_data_scientists/safe_streets_to_schools.ipynb +++ b/samples/04_gis_analysts_data_scientists/safe_streets_to_schools.ipynb @@ -159,7 +159,7 @@ " \n", "
Traffic collisions in Pasadena, California, since 2008.
Feature Layer Collection by api_data_owner\n", "
Last Modified: May 20, 2024\n", - "
0 comments, 7640 views\n", + "
0 comments, 7701 views\n", " \n", " \n", " " @@ -211,7 +211,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 7, "metadata": {}, "outputs": [ { @@ -236,7 +236,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 8, "metadata": {}, "outputs": [], "source": [ @@ -251,7 +251,7 @@ { "data": { "text/html": [ - "" + "" ], "text/plain": [ "" @@ -264,7 +264,6 @@ ], "source": [ "m1 = gis.map('Pasadena, California')\n", - "m1.zoom = 13\n", "m1.basemap.basemap = 'topo-vector'\n", "m1" ] @@ -285,12 +284,20 @@ "m1.content.add(collisions)" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "The `zoom` level for a map object is set after the map is rendered. We set the desired zoom level for this map and also display the legend on the map." + ] + }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 11, "metadata": {}, "outputs": [], "source": [ + "m1.zoom = 13\n", "m1.legend.enabled = True" ] }, @@ -303,7 +310,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 13, "metadata": {}, "outputs": [ { @@ -323,7 +330,7 @@ " dtype='object')" ] }, - "execution_count": 8, + "execution_count": 13, "metadata": {}, "output_type": "execute_result" } @@ -334,7 +341,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 14, "metadata": {}, "outputs": [ { @@ -350,7 +357,7 @@ "Length: 12, dtype: string" ] }, - "execution_count": 9, + "execution_count": 14, "metadata": {}, "output_type": "execute_result" } @@ -368,7 +375,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 15, "metadata": {}, "outputs": [], "source": [ @@ -405,7 +412,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 17, "metadata": {}, "outputs": [ { @@ -413,26 +420,26 @@ "text/html": [ "
\n", "
\n", - " \n", + " \n", " \n", " \n", "
\n", "\n", "
\n", - " density_of_incidents967701\n", + " density_of_incidents755975\n", " \n", "

Feature Layer Collection by MMajumdar_geosaurus\n", - "
Last Modified: November 14, 2024\n", + "
Last Modified: November 27, 2024\n", "
0 comments, 0 views\n", "
\n", "
\n", " " ], "text/plain": [ - "" + "" ] }, - "execution_count": 12, + "execution_count": 17, "metadata": {}, "output_type": "execute_result" } @@ -443,7 +450,7 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": 23, "metadata": {}, "outputs": [ { @@ -455,14 +462,13 @@ "" ] }, - "execution_count": 24, + "execution_count": 23, "metadata": {}, "output_type": "execute_result" } ], "source": [ "m2 = gis.map('Pasadena, California')\n", - "m2.zoom = 13\n", "m2.basemap.basemap = 'topo-vector'\n", "m2" ] @@ -485,7 +491,7 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": 20, "metadata": {}, "outputs": [], "source": [ @@ -494,7 +500,7 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": 22, "metadata": {}, "outputs": [], "source": [ @@ -521,7 +527,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 25, "metadata": {}, "outputs": [ { @@ -529,26 +535,26 @@ "text/html": [ "
\n", "
\n", - " \n", + " \n", " \n", " \n", "
\n", "\n", "
\n", - " collision_hexagon_hot_spots279247\n", + " collision_hexagon_hot_spots45977\n", " \n", "

Feature Layer Collection by MMajumdar_geosaurus\n", - "
Last Modified: November 14, 2024\n", + "
Last Modified: November 27, 2024\n", "
0 comments, 0 views\n", "
\n", "
\n", " " ], "text/plain": [ - "" + "" ] }, - "execution_count": 14, + "execution_count": 25, "metadata": {}, "output_type": "execute_result" } @@ -578,11 +584,17 @@ ], "source": [ "m3 = gis.map('Pasadena, California')\n", - "m3.zoomlevel = 13\n", "m3.basemap.basemap = 'arcgis-dark-gray'\n", "m3" ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, { "cell_type": "markdown", "metadata": {}, @@ -633,7 +645,7 @@ }, { "cell_type": "code", - "execution_count": 40, + "execution_count": 36, "metadata": {}, "outputs": [ { @@ -645,14 +657,13 @@ "" ] }, - "execution_count": 40, + "execution_count": 36, "metadata": {}, "output_type": "execute_result" } ], "source": [ "m4 = gis.map('Pasadena, California')\n", - "m4.zoom = 13\n", "m4.basemap.basemap = 'topo-vector'\n", "m4" ] @@ -666,7 +677,7 @@ }, { "cell_type": "code", - "execution_count": 37, + "execution_count": 32, "metadata": {}, "outputs": [], "source": [ @@ -675,7 +686,7 @@ }, { "cell_type": "code", - "execution_count": 38, + "execution_count": 33, "metadata": {}, "outputs": [], "source": [ @@ -685,7 +696,7 @@ }, { "cell_type": "code", - "execution_count": 39, + "execution_count": 34, "metadata": {}, "outputs": [], "source": [ @@ -715,7 +726,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 37, "metadata": { "scrolled": true }, @@ -726,7 +737,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 38, "metadata": {}, "outputs": [], "source": [ @@ -735,7 +746,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 39, "metadata": {}, "outputs": [ { @@ -947,7 +958,7 @@ "[5 rows x 57 columns]" ] }, - "execution_count": 13, + "execution_count": 39, "metadata": {}, "output_type": "execute_result" } @@ -978,7 +989,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 40, "metadata": {}, "outputs": [], "source": [ @@ -998,7 +1009,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 41, "metadata": {}, "outputs": [ { @@ -1007,7 +1018,7 @@ "\"\\nvar acc_type = $feature.InvWith;\\nvar fatal = $feature.Nokilled;\\nvar injured = $feature.NoInjured;\\nvar result = When( \\n acc_type == 'Pedestrian' && fatal == '1' , 'PedestrianFatality',\\n acc_type == 'Pedestrian' && injured != '0', 'PedestrianInjury',\\n acc_type == 'Bicycle' && injured != '0', 'BicycleInjury',\\n acc_type == 'Bicycle' && fatal == '1', 'BicycleFatality',\\n 'null');\\nreturn result;\\n\"" ] }, - "execution_count": 15, + "execution_count": 41, "metadata": {}, "output_type": "execute_result" } @@ -1025,7 +1036,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 42, "metadata": {}, "outputs": [], "source": [ @@ -1048,7 +1059,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 43, "metadata": {}, "outputs": [], "source": [ @@ -1067,14 +1078,14 @@ }, { "cell_type": "code", - "execution_count": 71, + "execution_count": 44, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "[{'value': 'PedestrianFatality', 'label': 'PedestrianFatality', 'symbol': SimpleMarkerSymbolEsriSMS(angle=None, color=[255, 0, 0, 255], outline=SimpleLineSymbolEsriSLS(color=[153, 153, 153, 255], marker=None, style='esriSLSSolid', type='esriSLS', width=0.375), size=15, style='esriSMSCircle', type='esriSMS', xoffset=None, yoffset=None)}, {'value': 'PedestrianInjury', 'label': 'PedestrianInjury', 'symbol': SimpleMarkerSymbolEsriSMS(angle=None, color=[0, 255, 0, 255], outline=SimpleLineSymbolEsriSLS(color=[153, 153, 153, 255], marker=None, style='esriSLSSolid', type='esriSLS', width=0.375), size=3, style='esriSMSCircle', type='esriSMS', xoffset=None, yoffset=None)}, {'value': 'BicycleInjury', 'label': 'BicycleInjury', 'symbol': SimpleMarkerSymbolEsriSMS(angle=None, color=[0, 0, 255, 255], outline=SimpleLineSymbolEsriSLS(color=[153, 153, 153, 255], marker=None, style='esriSLSSolid', type='esriSLS', width=0.375), size=3, style='esriSMSCircle', type='esriSMS', xoffset=None, yoffset=None)}, {'value': 'BicycleFatality', 'label': 'BicycleFatality', 'symbol': SimpleMarkerSymbolEsriSMS(angle=None, color=[0, 255, 255, 255], outline=SimpleLineSymbolEsriSLS(color=[153, 153, 153, 255], marker=None, style='esriSLSSolid', type='esriSLS', width=0.375), size=15, style='esriSMSCircle', type='esriSMS', xoffset=None, yoffset=None)}]\n" + "[{'label': 'PedestrianFatality', 'symbol': SimpleMarkerSymbolEsriSMS(angle=None, color=[255, 0, 0, 255], outline=SimpleLineSymbolEsriSLS(color=[153, 153, 153, 255], marker=None, style='esriSLSSolid', type='esriSLS', width=0.375), size=15, style='esriSMSCircle', type='esriSMS', xoffset=None, yoffset=None), 'value': 'PedestrianFatality'}, {'label': 'PedestrianInjury', 'symbol': SimpleMarkerSymbolEsriSMS(angle=None, color=[0, 255, 0, 255], outline=SimpleLineSymbolEsriSLS(color=[153, 153, 153, 255], marker=None, style='esriSLSSolid', type='esriSLS', width=0.375), size=3, style='esriSMSCircle', type='esriSMS', xoffset=None, yoffset=None), 'value': 'PedestrianInjury'}, {'label': 'BicycleInjury', 'symbol': SimpleMarkerSymbolEsriSMS(angle=None, color=[0, 0, 255, 255], outline=SimpleLineSymbolEsriSLS(color=[153, 153, 153, 255], marker=None, style='esriSLSSolid', type='esriSLS', width=0.375), size=3, style='esriSMSCircle', type='esriSMS', xoffset=None, yoffset=None), 'value': 'BicycleInjury'}, {'label': 'BicycleFatality', 'symbol': SimpleMarkerSymbolEsriSMS(angle=None, color=[0, 255, 255, 255], outline=SimpleLineSymbolEsriSLS(color=[153, 153, 153, 255], marker=None, style='esriSLSSolid', type='esriSLS', width=0.375), size=15, style='esriSMSCircle', type='esriSMS', xoffset=None, yoffset=None), 'value': 'BicycleFatality'}]\n" ] } ], @@ -1084,7 +1095,7 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": 45, "metadata": {}, "outputs": [], "source": [ @@ -1095,26 +1106,25 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": 52, "metadata": {}, "outputs": [ { "data": { "text/html": [ - "" + "" ], "text/plain": [ "" ] }, - "execution_count": 24, + "execution_count": 52, "metadata": {}, "output_type": "execute_result" } ], "source": [ "m5 = gis.map('Pasadena, California')\n", - "m5.zoom = 13\n", "m5.basemap.basemap = 'topo-vector'\n", "m5" ] @@ -1128,7 +1138,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 50, "metadata": {}, "outputs": [], "source": [ @@ -1137,10 +1147,11 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": 51, "metadata": {}, "outputs": [], "source": [ + "m5.zoom = 13\n", "m5.legend.enabled = True" ] }, @@ -1153,33 +1164,32 @@ }, { "cell_type": "code", - "execution_count": 29, + "execution_count": 65, "metadata": {}, "outputs": [ { "data": { "text/html": [ - "" + "" ], "text/plain": [ "" ] }, - "execution_count": 29, + "execution_count": 65, "metadata": {}, "output_type": "execute_result" } ], "source": [ "m6 = gis.map('Pasadena, California')\n", - "m6.zoom = 13\n", "m6.basemap.basemap = 'arcgis-dark-gray'\n", "m6" ] }, { "cell_type": "code", - "execution_count": 27, + "execution_count": 63, "metadata": {}, "outputs": [], "source": [ @@ -1188,10 +1198,11 @@ }, { "cell_type": "code", - "execution_count": 28, + "execution_count": 64, "metadata": {}, "outputs": [], "source": [ + "m6.zoom = 13\n", "m6.legend.enabled = True" ] }, @@ -1218,7 +1229,7 @@ }, { "cell_type": "code", - "execution_count": 30, + "execution_count": 66, "metadata": {}, "outputs": [], "source": [ @@ -1227,7 +1238,7 @@ }, { "cell_type": "code", - "execution_count": 31, + "execution_count": 67, "metadata": {}, "outputs": [ { @@ -1245,7 +1256,7 @@ " \n", "
Schools in the Pasadena Unified School District
Feature Layer Collection by Esri_Tutorials\n", "
Last Modified: October 14, 2024\n", - "
0 comments, 107443 views\n", + "
0 comments, 108080 views\n", " \n", " \n", " " @@ -1254,7 +1265,7 @@ "" ] }, - "execution_count": 31, + "execution_count": 67, "metadata": {}, "output_type": "execute_result" } @@ -1272,33 +1283,32 @@ }, { "cell_type": "code", - "execution_count": 38, + "execution_count": 74, "metadata": {}, "outputs": [ { "data": { "text/html": [ - "" + "" ], "text/plain": [ "" ] }, - "execution_count": 38, + "execution_count": 74, "metadata": {}, "output_type": "execute_result" } ], "source": [ "m7 = gis.map('Pasadena, California')\n", - "m7.zoom = 13\n", "m7.basemap.basemap = 'arcgis-dark-gray'\n", "m7" ] }, { "cell_type": "code", - "execution_count": 33, + "execution_count": 69, "metadata": {}, "outputs": [], "source": [ @@ -1317,7 +1327,7 @@ }, { "cell_type": "code", - "execution_count": 34, + "execution_count": 70, "metadata": {}, "outputs": [], "source": [ @@ -1339,7 +1349,7 @@ }, { "cell_type": "code", - "execution_count": 36, + "execution_count": 71, "metadata": {}, "outputs": [], "source": [ @@ -1349,10 +1359,11 @@ }, { "cell_type": "code", - "execution_count": 37, + "execution_count": 73, "metadata": {}, "outputs": [], "source": [ + "m7.zoom_to_layer(schools.layers[0])\n", "m7.legend.enabled = True" ] }, @@ -1394,7 +1405,7 @@ }, { "cell_type": "code", - "execution_count": 40, + "execution_count": 76, "metadata": {}, "outputs": [ { @@ -1402,26 +1413,26 @@ "text/html": [ "
\n", "
\n", - " \n", + " \n", " \n", " \n", "
\n", "\n", "
\n", - " psud_schools_drivetime804991\n", + " psud_schools_drivetime782682\n", " \n", "

Feature Layer Collection by MMajumdar_geosaurus\n", - "
Last Modified: November 19, 2024\n", - "
0 comments, 1 views\n", + "
Last Modified: November 27, 2024\n", + "
0 comments, 0 views\n", "
\n", "
\n", " " ], "text/plain": [ - "" + "" ] }, - "execution_count": 40, + "execution_count": 76, "metadata": {}, "output_type": "execute_result" } @@ -1451,7 +1462,6 @@ ], "source": [ "m8 = gis.map('Pasadena, California')\n", - "m8.zoom = 13\n", "m8.basemap.basemap = 'arcgis-dark-gray'\n", "m8" ] @@ -1488,6 +1498,7 @@ "metadata": {}, "outputs": [], "source": [ + "m8.zoom = 13\n", "m8.legend.enabled = True" ] }, @@ -1529,7 +1540,7 @@ }, { "cell_type": "code", - "execution_count": 49, + "execution_count": 78, "metadata": {}, "outputs": [ { @@ -1537,26 +1548,26 @@ "text/html": [ "
\n", "
\n", - " \n", + " \n", " \n", " \n", "
\n", "\n", "
\n", - " accident_count_within_school_zone185097\n", + " accident_count_within_school_zone865310\n", " \n", "

Feature Layer Collection by MMajumdar_geosaurus\n", - "
Last Modified: November 19, 2024\n", + "
Last Modified: November 27, 2024\n", "
0 comments, 0 views\n", "
\n", "
\n", " " ], "text/plain": [ - "" + "" ] }, - "execution_count": 49, + "execution_count": 78, "metadata": {}, "output_type": "execute_result" } @@ -1567,7 +1578,7 @@ }, { "cell_type": "code", - "execution_count": 50, + "execution_count": 79, "metadata": {}, "outputs": [], "source": [ @@ -1576,7 +1587,7 @@ }, { "cell_type": "code", - "execution_count": 54, + "execution_count": 80, "metadata": {}, "outputs": [ { @@ -1749,7 +1760,7 @@ "6 {\"rings\": [[[-13149814.2259, 4052416.3755], [-... " ] }, - "execution_count": 54, + "execution_count": 80, "metadata": {}, "output_type": "execute_result" } @@ -1798,7 +1809,6 @@ ], "source": [ "m9 = gis.map('Pasadena, California')\n", - "m9.zoom = 13\n", "m9.basemap.basemap = 'arcgis-dark-gray'\n", "m9" ] @@ -1847,6 +1857,7 @@ "metadata": {}, "outputs": [], "source": [ + "m9.zoom = 13\n", "m9.zoom_to_layer(schools.layers[0])" ] }, From 0bf79de9c8eb43e899f9697635998d92670408c7 Mon Sep 17 00:00:00 2001 From: Manushi Majumdar Date: Tue, 3 Dec 2024 19:56:18 -0500 Subject: [PATCH 5/6] changes to color for bicycle injury accident type in the maps --- .../safe_streets_to_schools.ipynb | 175 +++++++++--------- 1 file changed, 84 insertions(+), 91 deletions(-) diff --git a/samples/04_gis_analysts_data_scientists/safe_streets_to_schools.ipynb b/samples/04_gis_analysts_data_scientists/safe_streets_to_schools.ipynb index 23c19a41b..01cc7b829 100644 --- a/samples/04_gis_analysts_data_scientists/safe_streets_to_schools.ipynb +++ b/samples/04_gis_analysts_data_scientists/safe_streets_to_schools.ipynb @@ -104,7 +104,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Connect to the GIS via an existing profile or creating a new connection by e.g. gis = GIS(\"https://www.arcgis.com\", \"arcgis_python_123\", \"P@ssword123\")" + "Connect to the GIS via an existing profile." ] }, { @@ -159,7 +159,7 @@ " \n", "
Traffic collisions in Pasadena, California, since 2008.
Feature Layer Collection by api_data_owner\n", "
Last Modified: May 20, 2024\n", - "
0 comments, 7701 views\n", + "
0 comments, 7733 views\n", " \n", " \n", " " @@ -211,7 +211,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 6, "metadata": {}, "outputs": [ { @@ -236,7 +236,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 7, "metadata": {}, "outputs": [], "source": [ @@ -310,7 +310,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 8, "metadata": {}, "outputs": [ { @@ -330,7 +330,7 @@ " dtype='object')" ] }, - "execution_count": 13, + "execution_count": 8, "metadata": {}, "output_type": "execute_result" } @@ -341,7 +341,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 9, "metadata": {}, "outputs": [ { @@ -357,7 +357,7 @@ "Length: 12, dtype: string" ] }, - "execution_count": 14, + "execution_count": 9, "metadata": {}, "output_type": "execute_result" } @@ -375,7 +375,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 10, "metadata": {}, "outputs": [], "source": [ @@ -412,7 +412,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 12, "metadata": {}, "outputs": [ { @@ -420,26 +420,26 @@ "text/html": [ "
\n", "
\n", - " \n", + " \n", " \n", " \n", "
\n", "\n", "
\n", - " density_of_incidents755975\n", + " density_of_incidents238558\n", " \n", "

Feature Layer Collection by MMajumdar_geosaurus\n", - "
Last Modified: November 27, 2024\n", + "
Last Modified: December 03, 2024\n", "
0 comments, 0 views\n", "
\n", "
\n", " " ], "text/plain": [ - "" + "" ] }, - "execution_count": 17, + "execution_count": 12, "metadata": {}, "output_type": "execute_result" } @@ -527,7 +527,7 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": 14, "metadata": {}, "outputs": [ { @@ -535,26 +535,26 @@ "text/html": [ "
\n", "
\n", - " \n", + " \n", " \n", " \n", "
\n", "\n", "
\n", - " collision_hexagon_hot_spots45977\n", + " collision_hexagon_hot_spots995425\n", " \n", "

Feature Layer Collection by MMajumdar_geosaurus\n", - "
Last Modified: November 27, 2024\n", + "
Last Modified: December 03, 2024\n", "
0 comments, 0 views\n", "
\n", "
\n", " " ], "text/plain": [ - "" + "" ] }, - "execution_count": 25, + "execution_count": 14, "metadata": {}, "output_type": "execute_result" } @@ -588,13 +588,6 @@ "m3" ] }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - }, { "cell_type": "markdown", "metadata": {}, @@ -726,7 +719,7 @@ }, { "cell_type": "code", - "execution_count": 37, + "execution_count": 15, "metadata": { "scrolled": true }, @@ -737,7 +730,7 @@ }, { "cell_type": "code", - "execution_count": 38, + "execution_count": 16, "metadata": {}, "outputs": [], "source": [ @@ -746,7 +739,7 @@ }, { "cell_type": "code", - "execution_count": 39, + "execution_count": 17, "metadata": {}, "outputs": [ { @@ -958,7 +951,7 @@ "[5 rows x 57 columns]" ] }, - "execution_count": 39, + "execution_count": 17, "metadata": {}, "output_type": "execute_result" } @@ -989,7 +982,7 @@ }, { "cell_type": "code", - "execution_count": 40, + "execution_count": 18, "metadata": {}, "outputs": [], "source": [ @@ -1009,7 +1002,7 @@ }, { "cell_type": "code", - "execution_count": 41, + "execution_count": 19, "metadata": {}, "outputs": [ { @@ -1018,7 +1011,7 @@ "\"\\nvar acc_type = $feature.InvWith;\\nvar fatal = $feature.Nokilled;\\nvar injured = $feature.NoInjured;\\nvar result = When( \\n acc_type == 'Pedestrian' && fatal == '1' , 'PedestrianFatality',\\n acc_type == 'Pedestrian' && injured != '0', 'PedestrianInjury',\\n acc_type == 'Bicycle' && injured != '0', 'BicycleInjury',\\n acc_type == 'Bicycle' && fatal == '1', 'BicycleFatality',\\n 'null');\\nreturn result;\\n\"" ] }, - "execution_count": 41, + "execution_count": 19, "metadata": {}, "output_type": "execute_result" } @@ -1036,7 +1029,7 @@ }, { "cell_type": "code", - "execution_count": 42, + "execution_count": 20, "metadata": {}, "outputs": [], "source": [ @@ -1059,11 +1052,11 @@ }, { "cell_type": "code", - "execution_count": 43, + "execution_count": 79, "metadata": {}, "outputs": [], "source": [ - "color_list = [ [255, 0, 0, 255], [0, 255, 0, 255], [0, 0, 255, 255], [0 , 255, 255, 255] ] \n", + "color_list = [ [255, 0, 0, 255], [0, 255, 0, 255], [255, 172, 28, 255], [0 , 255, 255, 255] ] \n", "values = ['PedestrianFatality', 'PedestrianInjury', 'BicycleInjury', 'BicycleFatality']\n", "sizes = [15, 3, 3, 15]\n", "unique_value_list = get_unique_values(color_list, values)" @@ -1078,14 +1071,14 @@ }, { "cell_type": "code", - "execution_count": 44, + "execution_count": 80, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "[{'label': 'PedestrianFatality', 'symbol': SimpleMarkerSymbolEsriSMS(angle=None, color=[255, 0, 0, 255], outline=SimpleLineSymbolEsriSLS(color=[153, 153, 153, 255], marker=None, style='esriSLSSolid', type='esriSLS', width=0.375), size=15, style='esriSMSCircle', type='esriSMS', xoffset=None, yoffset=None), 'value': 'PedestrianFatality'}, {'label': 'PedestrianInjury', 'symbol': SimpleMarkerSymbolEsriSMS(angle=None, color=[0, 255, 0, 255], outline=SimpleLineSymbolEsriSLS(color=[153, 153, 153, 255], marker=None, style='esriSLSSolid', type='esriSLS', width=0.375), size=3, style='esriSMSCircle', type='esriSMS', xoffset=None, yoffset=None), 'value': 'PedestrianInjury'}, {'label': 'BicycleInjury', 'symbol': SimpleMarkerSymbolEsriSMS(angle=None, color=[0, 0, 255, 255], outline=SimpleLineSymbolEsriSLS(color=[153, 153, 153, 255], marker=None, style='esriSLSSolid', type='esriSLS', width=0.375), size=3, style='esriSMSCircle', type='esriSMS', xoffset=None, yoffset=None), 'value': 'BicycleInjury'}, {'label': 'BicycleFatality', 'symbol': SimpleMarkerSymbolEsriSMS(angle=None, color=[0, 255, 255, 255], outline=SimpleLineSymbolEsriSLS(color=[153, 153, 153, 255], marker=None, style='esriSLSSolid', type='esriSLS', width=0.375), size=15, style='esriSMSCircle', type='esriSMS', xoffset=None, yoffset=None), 'value': 'BicycleFatality'}]\n" + "[{'label': 'PedestrianFatality', 'symbol': SimpleMarkerSymbolEsriSMS(angle=None, color=[255, 0, 0, 255], outline=SimpleLineSymbolEsriSLS(color=[153, 153, 153, 255], marker=None, style='esriSLSSolid', type='esriSLS', width=0.375), size=15, style='esriSMSCircle', type='esriSMS', xoffset=None, yoffset=None), 'value': 'PedestrianFatality'}, {'label': 'PedestrianInjury', 'symbol': SimpleMarkerSymbolEsriSMS(angle=None, color=[0, 255, 0, 255], outline=SimpleLineSymbolEsriSLS(color=[153, 153, 153, 255], marker=None, style='esriSLSSolid', type='esriSLS', width=0.375), size=3, style='esriSMSCircle', type='esriSMS', xoffset=None, yoffset=None), 'value': 'PedestrianInjury'}, {'label': 'BicycleInjury', 'symbol': SimpleMarkerSymbolEsriSMS(angle=None, color=[255, 172, 28, 255], outline=SimpleLineSymbolEsriSLS(color=[153, 153, 153, 255], marker=None, style='esriSLSSolid', type='esriSLS', width=0.375), size=3, style='esriSMSCircle', type='esriSMS', xoffset=None, yoffset=None), 'value': 'BicycleInjury'}, {'label': 'BicycleFatality', 'symbol': SimpleMarkerSymbolEsriSMS(angle=None, color=[0, 255, 255, 255], outline=SimpleLineSymbolEsriSLS(color=[153, 153, 153, 255], marker=None, style='esriSLSSolid', type='esriSLS', width=0.375), size=15, style='esriSMSCircle', type='esriSMS', xoffset=None, yoffset=None), 'value': 'BicycleFatality'}]\n" ] } ], @@ -1095,7 +1088,7 @@ }, { "cell_type": "code", - "execution_count": 45, + "execution_count": 81, "metadata": {}, "outputs": [], "source": [ @@ -1106,19 +1099,19 @@ }, { "cell_type": "code", - "execution_count": 52, + "execution_count": 88, "metadata": {}, "outputs": [ { "data": { "text/html": [ - "" + "" ], "text/plain": [ "" ] }, - "execution_count": 52, + "execution_count": 88, "metadata": {}, "output_type": "execute_result" } @@ -1138,7 +1131,7 @@ }, { "cell_type": "code", - "execution_count": 50, + "execution_count": 86, "metadata": {}, "outputs": [], "source": [ @@ -1147,7 +1140,7 @@ }, { "cell_type": "code", - "execution_count": 51, + "execution_count": 87, "metadata": {}, "outputs": [], "source": [ @@ -1164,19 +1157,19 @@ }, { "cell_type": "code", - "execution_count": 65, + "execution_count": 89, "metadata": {}, "outputs": [ { "data": { "text/html": [ - "" + "" ], "text/plain": [ "" ] }, - "execution_count": 65, + "execution_count": 89, "metadata": {}, "output_type": "execute_result" } @@ -1189,7 +1182,7 @@ }, { "cell_type": "code", - "execution_count": 63, + "execution_count": 83, "metadata": {}, "outputs": [], "source": [ @@ -1198,7 +1191,7 @@ }, { "cell_type": "code", - "execution_count": 64, + "execution_count": 84, "metadata": {}, "outputs": [], "source": [ @@ -1229,7 +1222,7 @@ }, { "cell_type": "code", - "execution_count": 66, + "execution_count": 90, "metadata": {}, "outputs": [], "source": [ @@ -1238,7 +1231,7 @@ }, { "cell_type": "code", - "execution_count": 67, + "execution_count": 91, "metadata": {}, "outputs": [ { @@ -1256,7 +1249,7 @@ " \n", "
Schools in the Pasadena Unified School District
Feature Layer Collection by Esri_Tutorials\n", "
Last Modified: October 14, 2024\n", - "
0 comments, 108080 views\n", + "
0 comments, 108279 views\n", " \n", " \n", " " @@ -1265,7 +1258,7 @@ "" ] }, - "execution_count": 67, + "execution_count": 91, "metadata": {}, "output_type": "execute_result" } @@ -1283,19 +1276,19 @@ }, { "cell_type": "code", - "execution_count": 74, + "execution_count": 97, "metadata": {}, "outputs": [ { "data": { "text/html": [ - "" + "" ], "text/plain": [ "" ] }, - "execution_count": 74, + "execution_count": 97, "metadata": {}, "output_type": "execute_result" } @@ -1308,7 +1301,7 @@ }, { "cell_type": "code", - "execution_count": 69, + "execution_count": 93, "metadata": {}, "outputs": [], "source": [ @@ -1327,7 +1320,7 @@ }, { "cell_type": "code", - "execution_count": 70, + "execution_count": 94, "metadata": {}, "outputs": [], "source": [ @@ -1349,7 +1342,7 @@ }, { "cell_type": "code", - "execution_count": 71, + "execution_count": 95, "metadata": {}, "outputs": [], "source": [ @@ -1359,7 +1352,7 @@ }, { "cell_type": "code", - "execution_count": 73, + "execution_count": 96, "metadata": {}, "outputs": [], "source": [ @@ -1405,7 +1398,7 @@ }, { "cell_type": "code", - "execution_count": 76, + "execution_count": 100, "metadata": {}, "outputs": [ { @@ -1413,26 +1406,26 @@ "text/html": [ "
\n", "
\n", - " \n", + " \n", " \n", " \n", "
\n", "\n", "
\n", - " psud_schools_drivetime782682\n", + " psud_schools_drivetime398437\n", " \n", "

Feature Layer Collection by MMajumdar_geosaurus\n", - "
Last Modified: November 27, 2024\n", + "
Last Modified: December 03, 2024\n", "
0 comments, 0 views\n", "
\n", "
\n", " " ], "text/plain": [ - "" + "" ] }, - "execution_count": 76, + "execution_count": 100, "metadata": {}, "output_type": "execute_result" } @@ -1443,19 +1436,19 @@ }, { "cell_type": "code", - "execution_count": 47, + "execution_count": 106, "metadata": {}, "outputs": [ { "data": { "text/html": [ - "" + "" ], "text/plain": [ "" ] }, - "execution_count": 47, + "execution_count": 106, "metadata": {}, "output_type": "execute_result" } @@ -1475,7 +1468,7 @@ }, { "cell_type": "code", - "execution_count": 44, + "execution_count": 102, "metadata": {}, "outputs": [], "source": [ @@ -1485,7 +1478,7 @@ }, { "cell_type": "code", - "execution_count": 45, + "execution_count": 103, "metadata": {}, "outputs": [], "source": [ @@ -1494,7 +1487,7 @@ }, { "cell_type": "code", - "execution_count": 46, + "execution_count": 104, "metadata": {}, "outputs": [], "source": [ @@ -1540,7 +1533,7 @@ }, { "cell_type": "code", - "execution_count": 78, + "execution_count": 109, "metadata": {}, "outputs": [ { @@ -1548,26 +1541,26 @@ "text/html": [ "
\n", "
\n", - " \n", + " \n", " \n", " \n", "
\n", "\n", "
\n", - " accident_count_within_school_zone865310\n", + " accident_count_within_school_zone162401\n", " \n", "

Feature Layer Collection by MMajumdar_geosaurus\n", - "
Last Modified: November 27, 2024\n", + "
Last Modified: December 03, 2024\n", "
0 comments, 0 views\n", "
\n", "
\n", " " ], "text/plain": [ - "" + "" ] }, - "execution_count": 78, + "execution_count": 109, "metadata": {}, "output_type": "execute_result" } @@ -1578,7 +1571,7 @@ }, { "cell_type": "code", - "execution_count": 79, + "execution_count": 110, "metadata": {}, "outputs": [], "source": [ @@ -1587,7 +1580,7 @@ }, { "cell_type": "code", - "execution_count": 80, + "execution_count": 111, "metadata": {}, "outputs": [ { @@ -1760,7 +1753,7 @@ "6 {\"rings\": [[[-13149814.2259, 4052416.3755], [-... " ] }, - "execution_count": 80, + "execution_count": 111, "metadata": {}, "output_type": "execute_result" } @@ -1790,19 +1783,19 @@ }, { "cell_type": "code", - "execution_count": 66, + "execution_count": 128, "metadata": {}, "outputs": [ { "data": { "text/html": [ - "" + "" ], "text/plain": [ "" ] }, - "execution_count": 66, + "execution_count": 128, "metadata": {}, "output_type": "execute_result" } @@ -1815,7 +1808,7 @@ }, { "cell_type": "code", - "execution_count": 59, + "execution_count": 124, "metadata": {}, "outputs": [], "source": [ @@ -1824,7 +1817,7 @@ }, { "cell_type": "code", - "execution_count": 60, + "execution_count": 125, "metadata": {}, "outputs": [ { @@ -1833,7 +1826,7 @@ "True" ] }, - "execution_count": 60, + "execution_count": 125, "metadata": {}, "output_type": "execute_result" } @@ -1844,7 +1837,7 @@ }, { "cell_type": "code", - "execution_count": 61, + "execution_count": 126, "metadata": {}, "outputs": [], "source": [ @@ -1853,7 +1846,7 @@ }, { "cell_type": "code", - "execution_count": 65, + "execution_count": 127, "metadata": {}, "outputs": [], "source": [ From 633606248dd235dd4ffcedfd5652e227958c0b81 Mon Sep 17 00:00:00 2001 From: Manushi Majumdar Date: Wed, 4 Dec 2024 18:07:29 -0500 Subject: [PATCH 6/6] changes to color for schools in map --- .../safe_streets_to_schools.ipynb | 85 ++++++------------- 1 file changed, 28 insertions(+), 57 deletions(-) diff --git a/samples/04_gis_analysts_data_scientists/safe_streets_to_schools.ipynb b/samples/04_gis_analysts_data_scientists/safe_streets_to_schools.ipynb index 01cc7b829..22ee07707 100644 --- a/samples/04_gis_analysts_data_scientists/safe_streets_to_schools.ipynb +++ b/samples/04_gis_analysts_data_scientists/safe_streets_to_schools.ipynb @@ -1271,24 +1271,24 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "By default, the schools have red point symbols that can be difficult to distinguish from the accident points. We'll change the symbol so the schools stand out more. The square shape will be distinguishable from the circle shapes of the accidents. We'll also change the color to a light-gray so the symbols stand out against the dark basemap." + "By default, the schools have red point symbols that can be difficult to distinguish from the accident points. We'll change the symbol so the schools stand out more. The square shape will be distinguishable from the circle shapes of the accidents. We'll also change the color to platinum (light shade of gray) so the symbols stand out against the dark basemap." ] }, { "cell_type": "code", - "execution_count": 97, + "execution_count": 148, "metadata": {}, "outputs": [ { "data": { "text/html": [ - "" + "" ], "text/plain": [ "" ] }, - "execution_count": 97, + "execution_count": 148, "metadata": {}, "output_type": "execute_result" } @@ -1301,37 +1301,18 @@ }, { "cell_type": "code", - "execution_count": 93, - "metadata": {}, - "outputs": [], - "source": [ - "def get_symbol(color, size):\n", - " outline = symbols.SimpleLineSymbolEsriSLS(\n", - " color=[153,153,153,255],\n", - " style=symbols.SimpleLineSymbolStyle.esri_sls_solid,\n", - " width=0.375)\n", - " symbol = symbols.SimpleMarkerSymbolEsriSMS(\n", - " color=color,\n", - " style = symbols.SimpleMarkerSymbolStyle.esri_sms_circle,\n", - " size=size,\n", - " outline=outline)\n", - " return symbol" - ] - }, - { - "cell_type": "code", - "execution_count": 94, + "execution_count": 144, "metadata": {}, "outputs": [], "source": [ "outline = symbols.SimpleLineSymbolEsriSLS(\n", - " color=[153,153,153,255],\n", + " color=[229,228,226,255],\n", " style=symbols.SimpleLineSymbolStyle.esri_sls_solid,\n", " width=0.375)\n", "\n", "school_renderer = renderers.SimpleRenderer(\n", " symbol = symbols.SimpleMarkerSymbolEsriSMS(\n", - " color = [153,153,153,255],\n", + " color = [229,228,226,255],\n", " style = symbols.SimpleMarkerSymbolStyle.esri_sms_square,\n", " size = 13,\n", " outline = outline\n", @@ -1342,17 +1323,17 @@ }, { "cell_type": "code", - "execution_count": 95, + "execution_count": 145, "metadata": {}, "outputs": [], "source": [ - "m7.content.add(filtered_df, drawing_info={\"renderer\": accident_renderer})\n", - "m7.content.add(schools.layers[0], drawing_info={\"renderer\": school_renderer})" + "m7.content.add(schools.layers[0], drawing_info={\"renderer\": school_renderer})\n", + "m7.content.add(filtered_df, drawing_info={\"renderer\": accident_renderer})" ] }, { "cell_type": "code", - "execution_count": 96, + "execution_count": 147, "metadata": {}, "outputs": [], "source": [ @@ -1436,19 +1417,19 @@ }, { "cell_type": "code", - "execution_count": 106, + "execution_count": 153, "metadata": {}, "outputs": [ { "data": { "text/html": [ - "" + "" ], "text/plain": [ "" ] }, - "execution_count": 106, + "execution_count": 153, "metadata": {}, "output_type": "execute_result" } @@ -1468,17 +1449,17 @@ }, { "cell_type": "code", - "execution_count": 102, + "execution_count": 150, "metadata": {}, "outputs": [], "source": [ - "m8.content.add(filtered_df, drawing_info={\"renderer\": accident_renderer})\n", - "m8.content.add(schools.layers[0], drawing_info={\"renderer\": school_renderer})" + "m8.content.add(schools.layers[0], drawing_info={\"renderer\": school_renderer})\n", + "m8.content.add(filtered_df, drawing_info={\"renderer\": accident_renderer})" ] }, { "cell_type": "code", - "execution_count": 103, + "execution_count": 151, "metadata": {}, "outputs": [], "source": [ @@ -1487,12 +1468,11 @@ }, { "cell_type": "code", - "execution_count": 104, + "execution_count": 152, "metadata": {}, "outputs": [], "source": [ - "m8.zoom = 13\n", - "m8.legend.enabled = True" + "m8.zoom = 13" ] }, { @@ -1783,19 +1763,19 @@ }, { "cell_type": "code", - "execution_count": 128, + "execution_count": 160, "metadata": {}, "outputs": [ { "data": { "text/html": [ - "" + "" ], "text/plain": [ "" ] }, - "execution_count": 128, + "execution_count": 160, "metadata": {}, "output_type": "execute_result" } @@ -1808,16 +1788,17 @@ }, { "cell_type": "code", - "execution_count": 124, + "execution_count": 157, "metadata": {}, "outputs": [], "source": [ + "m9.content.add(schools.layers[0], drawing_info={\"renderer\": school_renderer})\n", "m9.content.add(filtered_df, drawing_info={\"renderer\": accident_renderer})" ] }, { "cell_type": "code", - "execution_count": 125, + "execution_count": 158, "metadata": {}, "outputs": [ { @@ -1826,7 +1807,7 @@ "True" ] }, - "execution_count": 125, + "execution_count": 158, "metadata": {}, "output_type": "execute_result" } @@ -1837,20 +1818,10 @@ }, { "cell_type": "code", - "execution_count": 126, - "metadata": {}, - "outputs": [], - "source": [ - "m9.content.add(schools.layers[0], drawing_info={\"renderer\": school_renderer})" - ] - }, - { - "cell_type": "code", - "execution_count": 127, + "execution_count": 159, "metadata": {}, "outputs": [], "source": [ - "m9.zoom = 13\n", "m9.zoom_to_layer(schools.layers[0])" ] },