From 055b5b68539b7b16253d27d7cd6feb31cd0c23c1 Mon Sep 17 00:00:00 2001 From: John Yaist Date: Sat, 14 Sep 2024 11:49:53 -0700 Subject: [PATCH] copy smart mapping from next to align --- guide/10-mapping-and-visualization/smart-mapping.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guide/10-mapping-and-visualization/smart-mapping.ipynb b/guide/10-mapping-and-visualization/smart-mapping.ipynb index 59a87954f2..1dbb051b46 100644 --- a/guide/10-mapping-and-visualization/smart-mapping.ipynb +++ b/guide/10-mapping-and-visualization/smart-mapping.ipynb @@ -1 +1 @@ -{"cells":[{"cell_type":"markdown","metadata":{},"source":["# Smart Mapping\n","Smart Mapping is a new capability built into ArcGIS Online and Portal for ArcGIS (10.3.1 and after) with which you can easily create beautiful and stunning maps. With smart mapping your GIS gets the ability to quickly analyze your data and set smart defaults allowing you to easily create an illustrative map.\n","\n","To learn more about this exciting capability visit [the help page](http://www.esri.com/software/arcgis/smart-mapping) and [this blog article](https://blogs.esri.com/esri/arcgis/2015/03/02/introducing-smart-mapping/). Here is a [detailed help](http://doc.arcgis.com/en/arcgis-online/create-maps/change-style.htm) on the various ways you can symbolize your data."]},{"cell_type":"markdown","metadata":{"toc":true},"source":["

Table of Contents

\n","
"]},{"cell_type":"markdown","metadata":{},"source":["## Visualizing line features\n","The first example shows some ideas on visualizing linear features using a streets layer. When you add an `Item` object to your map, the map widget renders it using the default symbology of the item. With smart mapping, you can customize this. In this example we will use **ClassSizeRenderer** to emphasize differences in value by varying the thickness of line features."]},{"cell_type":"code","execution_count":null,"metadata":{},"outputs":[],"source":["from arcgis.gis import *\n","gis = GIS()"]},{"cell_type":"code","execution_count":null,"metadata":{},"outputs":[],"source":["map1 = gis.map('USA',3)\n","map1"]},{"cell_type":"markdown","metadata":{},"source":[""]},{"cell_type":"markdown","metadata":{},"source":["Let us search for an item titled **USA Freeway System** by **Esri** and add that to the map"]},{"cell_type":"code","execution_count":3,"metadata":{},"outputs":[{"data":{"text/plain":["[,\n"," ]"]},"execution_count":3,"metadata":{},"output_type":"execute_result"}],"source":["search_result = gis.content.search('title:USA freeway system AND owner:esri_dm', \n"," item_type = 'Feature Layer')\n","search_result"]},{"cell_type":"markdown","metadata":{},"source":["> **Note:** Either feature layer collection returned should work for this exercise. If the layer doesn't draw immediately, you may need to zoom in before features draw."]},{"cell_type":"code","execution_count":null,"metadata":{},"outputs":[],"source":["freeway_item = search_result[0]\n","map1.add_layer(freeway_item)"]},{"cell_type":"markdown","metadata":{},"source":["The freeway layer uses a simple symbology. Let us visualize it by one of the fields available on the feature layer. To do that, we get the Item's layers as **FeatureLayer** objects. From the `FeatureLayer` object, we can find the url and available fields."]},{"cell_type":"code","execution_count":null,"metadata":{},"outputs":[{"name":"stdout","output_type":"stream","text":["http://services.arcgis.com/P3ePLMYs2RVChkJx/arcgis/rest/services/USA_Freeway_System/FeatureServer/1\n","OBJECTID\n","ROUTE_NUM\n","CLASS\n","NUMBER\n","SUFFIX\n","DIST_MILES\n","DIST_KM\n"]}],"source":["# Use the first layer available on the service.\n","freeway_feature_layer = freeway_item.layers[0]\n","\n","# Print the layer's url and field names.\n","print(freeway_feature_layer.url)\n","for field in freeway_feature_layer.properties['fields']:\n"," print(field['name'])"]},{"cell_type":"markdown","metadata":{},"source":["Let us use `DIST_MILES` field and symbolize it with varying colors. Let us also change the extent of the map to illustrate the differences better."]},{"cell_type":"code","execution_count":null,"metadata":{"collapsed":true},"outputs":[],"source":["map1.add_layer(freeway_feature_layer, {\"renderer\":\"ClassedSizeRenderer\", \"field_name\": \"DIST_MILES\"})"]},{"cell_type":"code","execution_count":null,"metadata":{"collapsed":true},"outputs":[],"source":["# Change map's extent to Los Angeles city\n","map1.center = [34, -118]"]},{"cell_type":"code","execution_count":null,"metadata":{"collapsed":true},"outputs":[],"source":["map1.zoom = 10"]},{"cell_type":"markdown","metadata":{},"source":["Thus, we represented longer freeways as thicker lines and shorter ones with thinner lines."]},{"cell_type":"markdown","metadata":{},"source":["## Visualizing area features\n","Area or polygon features are typically symbolized in varying colors to represent the differences in values. The example below shows how a **Classed Color Renderer** can be used to visualize the population differences between the counties of the state of Washington.\n","\n","As you have seen in the previous sample, by using the **smart mapping** capability, you can author the map just by specifying the renderer type and the field to use and your GIS does the rest such identifying a suitable color scheme based on your basemap and the min and max values for the color ramp.\n","\n","The sample also shows how a definition expression can be used to limit the features displayed from the layer, and how the layer can be represented with transparency allowing the basemap to be seen."]},{"cell_type":"code","execution_count":null,"metadata":{"collapsed":true},"outputs":[],"source":["map2 = gis.map('Seattle, WA', 6)"]},{"cell_type":"code","execution_count":null,"metadata":{"collapsed":true},"outputs":[],"source":["map2"]},{"cell_type":"markdown","metadata":{},"source":[""]},{"cell_type":"markdown","metadata":{},"source":["The steps to search for a Feature Layer item and obtaining its url is demonstrated in the previous sample. For brevity, this sample skips that part."]},{"cell_type":"code","execution_count":null,"metadata":{"collapsed":true},"outputs":[],"source":["map2.add_layer({\"type\":\"FeatureLayer\", \n"," \"url\":\"//sampleserver6.arcgisonline.com/arcgis/rest/services/Census/MapServer/2\",\n"," \"definition_expression\" : \"STATE_NAME='Washington'\",\n"," \"renderer\":\"ClassedColorRenderer\",\n"," \"field_name\":\"POP2007\",\n"," \"opacity\":0.7\n"," })"]},{"cell_type":"markdown","metadata":{},"source":["## Visualizing location data\n","Point features are the most common type of location data. Smart mapping provides a special visualization technique called **heatmap**. The heatmap renderer is useful when representing the spatial distribution or clustering of points as it represents the relative density of points on a map as smoothly varying sets of colors ranging from cool (low density) to hot (many points).\n","\n","Thus, the sample below visualizes earthquake occurrences in Southern California, using the heatmap renderer"]},{"cell_type":"code","execution_count":null,"metadata":{"collapsed":true},"outputs":[],"source":["map3 = gis.map('Los Angeles', 8)"]},{"cell_type":"code","execution_count":null,"metadata":{"collapsed":true},"outputs":[],"source":["map3"]},{"cell_type":"markdown","metadata":{},"source":[""]},{"cell_type":"code","execution_count":null,"metadata":{"collapsed":true},"outputs":[],"source":["map3.add_layer({\"type\":\"FeatureLayer\",\n"," \"url\":\"http://services1.arcgis.com/hLJbHVT9ZrDIzK0I/arcgis/rest/services/EQMagGt4/FeatureServer/0\",\n"," \"renderer\":\"HeatmapRenderer\",\n"," \"opacity\":0.75})"]}],"metadata":{"anaconda-cloud":{},"celltoolbar":"Raw Cell Format","kernelspec":{"display_name":"Python 3","language":"python","name":"python3"},"language_info":{"codemirror_mode":{"name":"ipython","version":3},"file_extension":".py","mimetype":"text/x-python","name":"python","nbconvert_exporter":"python","pygments_lexer":"ipython3","version":"3.12.4"},"toc":{"base_numbering":1,"nav_menu":{},"number_sections":true,"sideBar":true,"skip_h1_title":false,"title_cell":"Table of Contents","title_sidebar":"Contents","toc_cell":true,"toc_position":{},"toc_section_display":true,"toc_window_display":true}},"nbformat":4,"nbformat_minor":1} +{"cells": [{"cell_type": "markdown", "metadata": {}, "source": ["# Smart Mapping\n", "Smart Mapping is a new capability built into ArcGIS Online and Portal for ArcGIS (10.3.1 and after) with which you can easily create beautiful and stunning maps. With smart mapping your GIS gets the ability to quickly analyze your data and set smart defaults allowing you to easily create an illustrative map.\n", "\n", "To learn more about this exciting capability visit [the help page](http://www.esri.com/software/arcgis/smart-mapping) and [this blog article](https://blogs.esri.com/esri/arcgis/2015/03/02/introducing-smart-mapping/). Here is a [detailed help](http://doc.arcgis.com/en/arcgis-online/create-maps/change-style.htm) on the various ways you can symbolize your data."]}, {"cell_type": "markdown", "metadata": {"toc": true}, "source": ["

Table of Contents

\n", ""]}, {"cell_type": "markdown", "metadata": {}, "source": ["## Visualizing line features\n", "The first example shows some ideas on visualizing linear features using a streets layer. When you add an `Item` object to your map, the map widget renders it using the default symbology of the item. With smart mapping, you can customize this. In this example we will use **ClassSizeRenderer** to emphasize differences in value by varying the thickness of line features."]}, {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": ["from arcgis.gis import *\n", "gis = GIS()"]}, {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": ["map1 = gis.map('USA',3)\n", "map1"]}, {"cell_type": "markdown", "metadata": {}, "source": [""]}, {"cell_type": "markdown", "metadata": {}, "source": ["Let us search for an item titled **USA Freeway System** by **Esri** and add that to the map"]}, {"cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [{"data": {"text/plain": ["[,\n", " ]"]}, "execution_count": 3, "metadata": {}, "output_type": "execute_result"}], "source": ["search_result = gis.content.search('title:USA freeway system AND owner:esri_dm', \n", " item_type = 'Feature Layer')\n", "search_result"]}, {"cell_type": "markdown", "metadata": {}, "source": ["> **Note:** Either feature layer collection returned should work for this exercise. If the layer doesn't draw immediately, you may need to zoom in before features draw."]}, {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": ["freeway_item = search_result[0]\n", "map1.add_layer(freeway_item)"]}, {"cell_type": "markdown", "metadata": {}, "source": ["The freeway layer uses a simple symbology. Let us visualize it by one of the fields available on the feature layer. To do that, we get the Item's layers as **FeatureLayer** objects. From the `FeatureLayer` object, we can find the url and available fields."]}, {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [{"name": "stdout", "output_type": "stream", "text": ["http://services.arcgis.com/P3ePLMYs2RVChkJx/arcgis/rest/services/USA_Freeway_System/FeatureServer/1\n", "OBJECTID\n", "ROUTE_NUM\n", "CLASS\n", "NUMBER\n", "SUFFIX\n", "DIST_MILES\n", "DIST_KM\n"]}], "source": ["# Use the first layer available on the service.\n", "freeway_feature_layer = freeway_item.layers[0]\n", "\n", "# Print the layer's url and field names.\n", "print(freeway_feature_layer.url)\n", "for field in freeway_feature_layer.properties['fields']:\n", " print(field['name'])"]}, {"cell_type": "markdown", "metadata": {}, "source": ["Let us use `DIST_MILES` field and symbolize it with varying colors. Let us also change the extent of the map to illustrate the differences better."]}, {"cell_type": "code", "execution_count": null, "metadata": {"collapsed": true}, "outputs": [], "source": ["map1.add_layer(freeway_feature_layer, {\"renderer\":\"ClassedSizeRenderer\", \"field_name\": \"DIST_MILES\"})"]}, {"cell_type": "code", "execution_count": null, "metadata": {"collapsed": true}, "outputs": [], "source": ["# Change map's extent to Los Angeles city\n", "map1.center = [34, -118]"]}, {"cell_type": "code", "execution_count": null, "metadata": {"collapsed": true}, "outputs": [], "source": ["map1.zoom = 10"]}, {"cell_type": "markdown", "metadata": {}, "source": ["Thus, we represented longer freeways as thicker lines and shorter ones with thinner lines."]}, {"cell_type": "markdown", "metadata": {}, "source": ["## Visualizing area features\n", "Area or polygon features are typically symbolized in varying colors to represent the differences in values. The example below shows how a **Classed Color Renderer** can be used to visualize the population differences between the counties of the state of Washington.\n", "\n", "As you have seen in the previous sample, by using the **smart mapping** capability, you can author the map just by specifying the renderer type and the field to use and your GIS does the rest such identifying a suitable color scheme based on your basemap and the min and max values for the color ramp.\n", "\n", "The sample also shows how a definition expression can be used to limit the features displayed from the layer, and how the layer can be represented with transparency allowing the basemap to be seen."]}, {"cell_type": "code", "execution_count": null, "metadata": {"collapsed": true}, "outputs": [], "source": ["map2 = gis.map('Seattle, WA', 6)"]}, {"cell_type": "code", "execution_count": null, "metadata": {"collapsed": true}, "outputs": [], "source": ["map2"]}, {"cell_type": "markdown", "metadata": {}, "source": [""]}, {"cell_type": "markdown", "metadata": {}, "source": ["The steps to search for a Feature Layer item and obtaining its url is demonstrated in the previous sample. For brevity, this sample skips that part."]}, {"cell_type": "code", "execution_count": null, "metadata": {"collapsed": true}, "outputs": [], "source": ["map2.add_layer({\"type\":\"FeatureLayer\", \n", " \"url\":\"//sampleserver6.arcgisonline.com/arcgis/rest/services/Census/MapServer/2\",\n", " \"definition_expression\" : \"STATE_NAME='Washington'\",\n", " \"renderer\":\"ClassedColorRenderer\",\n", " \"field_name\":\"POP2007\",\n", " \"opacity\":0.7\n", " })"]}, {"cell_type": "markdown", "metadata": {}, "source": ["## Visualizing location data\n", "Point features are the most common type of location data. Smart mapping provides a special visualization technique called **heatmap**. The heatmap renderer is useful when representing the spatial distribution or clustering of points as it represents the relative density of points on a map as smoothly varying sets of colors ranging from cool (low density) to hot (many points).\n", "\n", "Thus, the sample below visualizes earthquake occurrences in Southern California, using the heatmap renderer"]}, {"cell_type": "code", "execution_count": null, "metadata": {"collapsed": true}, "outputs": [], "source": ["map3 = gis.map('Los Angeles', 8)"]}, {"cell_type": "code", "execution_count": null, "metadata": {"collapsed": true}, "outputs": [], "source": ["map3"]}, {"cell_type": "markdown", "metadata": {}, "source": [""]}, {"cell_type": "code", "execution_count": null, "metadata": {"collapsed": true}, "outputs": [], "source": ["map3.add_layer({\"type\":\"FeatureLayer\",\n", " \"url\":\"http://services1.arcgis.com/hLJbHVT9ZrDIzK0I/arcgis/rest/services/EQMagGt4/FeatureServer/0\",\n", " \"renderer\":\"HeatmapRenderer\",\n", " \"opacity\":0.75})"]}], "metadata": {"anaconda-cloud": {}, "celltoolbar": "Raw Cell Format", "kernelspec": {"display_name": "Python 3", "language": "python", "name": "python3"}, "language_info": {"codemirror_mode": {"name": "ipython", "version": 3}, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.8.2"}, "toc": {"base_numbering": 1, "nav_menu": {}, "number_sections": true, "sideBar": true, "skip_h1_title": false, "title_cell": "Table of Contents", "title_sidebar": "Contents", "toc_cell": true, "toc_position": {}, "toc_section_display": true, "toc_window_display": true}}, "nbformat": 4, "nbformat_minor": 1} \ No newline at end of file