Skip to content

Commit 533508a

Browse files
committed
addressing more of Brecks comments
1 parent d220726 commit 533508a

5 files changed

+265
-143
lines changed

guide/10-mapping-and-visualization-alt/part1_introduction_to_mapping_and_visualization.ipynb

Lines changed: 24 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -16,42 +16,37 @@
1616
},
1717
"source": [
1818
"<h1>Table of Contents<span class=\"tocSkip\"></span></h1>\n",
19-
"<div class=\"toc\"><ul class=\"toc-item\"><li><span><a href=\"#The-widgets-module\" data-toc-modified-id=\"The-widgets-module-1\">The widgets module</a></span><ul class=\"toc-item\"><li><span><a href=\"#Jupyter-Notebook-and-its-graphical-outputs\" data-toc-modified-id=\"Jupyter-Notebook-and-its-graphical-outputs-1.1\">Jupyter Notebook and its graphical outputs</a></span></li><li><span><a href=\"#The-widgets-module-and-the-MapView-class\" data-toc-modified-id=\"The-widgets-module-and-the-MapView-class-1.2\">The widgets module and the MapView class</a></span></li></ul></li><li><span><a href=\"#Quick-start-example\" data-toc-modified-id=\"Quick-start-example-2\">Quick start example</a></span><ul class=\"toc-item\"><li><span><a href=\"#Creating-a-map-widget\" data-toc-modified-id=\"Creating-a-map-widget-2.1\">Creating a map widget</a></span></li><li><span><a href=\"#Adding-layers-to-the-map\" data-toc-modified-id=\"Adding-layers-to-the-map-2.2\">Adding layers to the map</a></span><ul class=\"toc-item\"><li><span><a href=\"#Add-search-result-to-the-map\" data-toc-modified-id=\"Add-search-result-to-the-map-2.2.1\">Add search result to the map</a></span></li><li><span><a href=\"#Add-Item-to-the-map\" data-toc-modified-id=\"Add-Item-to-the-map-2.2.2\">Add Item to the map</a></span></li><li><span><a href=\"#Adding-layer-objects-to-the-map\" data-toc-modified-id=\"Adding-layer-objects-to-the-map-2.2.3\">Adding layer objects to the map</a></span></li></ul></li><li><span><a href=\"#Saving-the-map-as-a-web-map\" data-toc-modified-id=\"Saving-the-map-as-a-web-map-2.3\">Saving the map as a web map</a></span></li></ul></li><li><span><a href=\"#The-Object-Model-Diagram-of-the-widgets-module\" data-toc-modified-id=\"The-Object-Model-Diagram-of-the-widgets-module-3\">The Object Model Diagram of the widgets module</a></span></li><li><span><a href=\"#Conclusions\" data-toc-modified-id=\"Conclusions-4\">Conclusions</a></span></li></ul></div>"
19+
"<div class=\"toc\"><ul class=\"toc-item\"><li><span><a href=\"#Introduction-to-the-widgets-module\" data-toc-modified-id=\"Introduction-to-the-widgets-module-1\">Introduction to the <code>widgets</code> module</a></span></li><li><span><a href=\"#Quick-start-example\" data-toc-modified-id=\"Quick-start-example-2\">Quick start example</a></span><ul class=\"toc-item\"><li><span><a href=\"#Creating-a-map-widget\" data-toc-modified-id=\"Creating-a-map-widget-2.1\">Creating a map widget</a></span></li><li><span><a href=\"#Adding-layers-to-the-map\" data-toc-modified-id=\"Adding-layers-to-the-map-2.2\">Adding layers to the map</a></span><ul class=\"toc-item\"><li><span><a href=\"#Add-search-result-to-the-map\" data-toc-modified-id=\"Add-search-result-to-the-map-2.2.1\">Add search result to the map</a></span></li><li><span><a href=\"#Add-Item-to-the-map\" data-toc-modified-id=\"Add-Item-to-the-map-2.2.2\">Add Item to the map</a></span></li><li><span><a href=\"#Adding-layer-objects-to-the-map\" data-toc-modified-id=\"Adding-layer-objects-to-the-map-2.2.3\">Adding layer objects to the map</a></span></li></ul></li><li><span><a href=\"#Saving-the-map-as-a-web-map\" data-toc-modified-id=\"Saving-the-map-as-a-web-map-2.3\">Saving the map as a web map</a></span></li></ul></li><li><span><a href=\"#The-Object-Model-Diagram-of-the-widgets-module\" data-toc-modified-id=\"The-Object-Model-Diagram-of-the-widgets-module-3\">The Object Model Diagram of the widgets module</a></span></li><li><span><a href=\"#Conclusions\" data-toc-modified-id=\"Conclusions-4\">Conclusions</a></span></li></ul></div>"
2020
]
2121
},
2222
{
2323
"cell_type": "markdown",
2424
"metadata": {},
2525
"source": [
26-
"## The widgets module\n",
27-
"\n",
28-
"### Jupyter Notebook and its graphical outputs\n",
26+
"## Introduction to the `widgets` module\n",
2927
"\n",
3028
"The `ArcGIS API for Python` is easy to learn and extremely useful for data scientists, GIS administrators, and GIS analysts. One of the features that makes this API so powerful is its integration with `Jupyter Notebook`. The interactive Jupyter Notebook environment is built around the concept of cells that can contain executable code or text and illustrative graphics written in Markdown format. Cells can be run in any order and any number of times. When a cell is run, its output is displayed immediately below the cell. This encourages tweaking and rerunning code until the perfect solution is found—illustrating the `REPL` paradigm in action.\n",
3129
"\n",
3230
"Because it is a web application running in a browser, Jupyter Notebook supports the display of graphic outputs. Write a snippet of Python code to plot a bar chart of household income of a county, and the chart will be displayed right below the cell containing that code.\n",
3331
"\n",
3432
"`Jupyter Notebook` is also a great medium to work with and explore spatial data. Using just a single line of code, a live interactive map can be inserted into a notebook. Another line of code can add content to that map that is the result of a search. That content can be added with its default symbology or using smart mapping the API can figure out how best to symbolize the data. `Spatially Enabled DataFrame` (SeDF) objects returned from a query for features in a feature layer can be visualized as a table in Jupyter Notebook.\n",
3533
"\n",
36-
"The ArcGIS API for Python builds on the rich illustrative framework available in Jupyter Notebook. The API provides access to the spatial data exploration, mapping, visualization, and analysis capabilities of the ArcGIS platform. A published `imagery` layer can effortlessly be overlaid on the map. With support for raster functions as native Python functions in the Python API, analyses can be applied and rendered instantly on the map.\n",
37-
"\n",
38-
"Workflows, data connections, outputs in the form of illustrative charts and maps, and informational text about conclusions — it can all be stored and worked with in a notebook. A Jupyter Notebook can become a functional record of a workflow that can be shared with anyone. All the recipient must do is run the cells to reproduce that workflow. Jupyter Notebook encourages research that is reproducible, since not only the findings but the code used to arrive at them is stored.\n",
34+
"Workflows, data connections, outputs in the form of illustrative charts and maps, informational text about conclusions — these can all be stored and worked with in a notebook. A Jupyter Notebook can become a functional record of a workflow that can be shared with anyone. All the recipient must do is run the cells to reproduce that workflow. Jupyter Notebook encourages research that is reproducible, since not only the findings, but the code used to arrive at them, are stored.\n",
3935
"\n",
40-
"### The widgets module and the MapView class\n",
36+
"The `arcgis.widgets` module offers components for managing maps and scenes to visualize GIS data and analysis in a rich, user-friendly, and interactive way that is specifically designed to work with 2D or 3D data content.\n",
4137
"\n",
42-
"The `arcgis.widgets` module offers components for managing maps and scenes to visualize GIS data and analysis, in a rich, user-friendly, and interactive way, specifically designed to work with 2D or 3D data content.\n",
38+
"The `GIS` object includes a map widget (of the `arcgis.widgets.MapView` class) for displaying geographic locations, visualizing GIS content, and the results of your analysis. Based on `ipywidgets.widgets.domwidget.DOMWidget`, the `MapView` class creates a mapping widget for Jupyter Notebook and JupyterLab.\n",
4339
"\n",
44-
"The `GIS` object includes a map widget (of `arcgis.widgets.MapView` class) for displaying geographic locations, visualizing GIS content, as well as the results of your analysis. Based of `ipywidgets.widgets.domwidget.DOMWidget`, the `MapView` class creates a mapping widget for Jupyter Notebook and JupyterLab. \n",
45-
"\n",
46-
"To use the map widget, call `gis.map()` and assign it to a variable, that you can then query to bring up the widget in the notebook."
40+
"To use the map widget, call `gis.map()` and assign it to a variable that you can then query to bring up the widget in the notebook."
4741
]
4842
},
4943
{
5044
"cell_type": "markdown",
5145
"metadata": {},
5246
"source": [
5347
"## Quick start example \n",
54-
"Next, let us quickly explore some examples of creating a map widget in notebook, adding layers to it and saving it as a web map item\n",
48+
"\n",
49+
"Next, let's quickly explore some examples of creating a map widget in a notebook, adding layers to it, and saving it as a web map item.\n",
5550
"\n",
5651
"### Creating a map widget"
5752
]
@@ -178,7 +173,7 @@
178173
"metadata": {},
179174
"source": [
180175
"#### Add Item to the map\n",
181-
"You can add Item objects to a map by passing its object id to the `add_layer()` method"
176+
"You can add an `Item` object to a map by passing its object id to the `add_layer()` method:"
182177
]
183178
},
184179
{
@@ -196,7 +191,7 @@
196191
"metadata": {},
197192
"source": [
198193
"#### Adding layer objects to the map\n",
199-
"You can add a number of different layer objects such as `FeatureLayer`, `FeatureCollection`, `ImageryLayer`, `MapImageLayer` to the map. For example, you can add a `FeatureLayer` as shown below:"
194+
"You can add a number of different layer objects, such as `FeatureLayer`, `FeatureCollection`, `ImageryLayer`, `MapImageLayer`, to the map. For example, you can add a `FeatureLayer`, as shown below:"
200195
]
201196
},
202197
{
@@ -235,43 +230,22 @@
235230
"metadata": {},
236231
"source": [
237232
"### Saving the map as a web map\n",
238-
"Starting with the Python API version 1.3, you can save the map widget as a web map in your `GIS`. This process persists all the basemaps, layers added with or without your custom symbology including smart mapping, pop-ups, extent, graphics drawn with or without custom symbols as layers in your web map.\n",
233+
"Starting with the Python API version 1.3, you can save the map widget as a web map in your `GIS`. This process persists all the basemaps, layers added with or without your custom symbology (including smart mapping), pop-ups, extent, and graphics drawn (with or without custom symbols) as layers in your web map.\n",
239234
"\n",
240235
"To save the map, call the `save()` method. This method creates and returns a new Web Map Item object. As parameters, you can specify all valid `Item` properties as shown below:"
241236
]
242237
},
243238
{
244239
"cell_type": "code",
245-
"execution_count": 10,
240+
"execution_count": 1,
246241
"metadata": {},
247242
"outputs": [
248243
{
249-
"data": {
250-
"text/html": [
251-
"<div class=\"item_container\" style=\"height: auto; overflow: hidden; border: 1px solid #cfcfcf; border-radius: 2px; background: #f6fafa; line-height: 1.21429em; padding: 10px;\">\n",
252-
" <div class=\"item_left\" style=\"width: 210px; float: left;\">\n",
253-
" <a href='https://geosaurus.maps.arcgis.com/home/item.html?id=ffdb77d64b2b4bbc9ac94843fc4e4e24' target='_blank'>\n",
254-
" <img src='http://static.arcgis.com/images/desktopapp.png' class=\"itemThumbnail\">\n",
255-
" </a>\n",
256-
" </div>\n",
257-
"\n",
258-
" <div class=\"item_right\" style=\"float: none; width: auto; overflow: hidden;\">\n",
259-
" <a href='https://geosaurus.maps.arcgis.com/home/item.html?id=ffdb77d64b2b4bbc9ac94843fc4e4e24' target='_blank'><b>USA time zones and traffic counts WebMap</b>\n",
260-
" </a>\n",
261-
" <br/>Jupyter notebook widget saved as a web map<img src='https://geosaurus.maps.arcgis.com/home/js/jsapi/esri/css/images/item_type_icons/maps16.png' style=\"vertical-align:middle;\">Web Map by arcgis_python\n",
262-
" <br/>Last Modified: August 12, 2021\n",
263-
" <br/>0 comments, 0 views\n",
264-
" </div>\n",
265-
" </div>\n",
266-
" "
267-
],
268-
"text/plain": [
269-
"<Item title:\"USA time zones and traffic counts WebMap\" type:Web Map owner:arcgis_python>"
270-
]
271-
},
272-
"execution_count": 10,
273-
"metadata": {},
274-
"output_type": "execute_result"
244+
"name": "stdout",
245+
"output_type": "stream",
246+
"text": [
247+
"<Web Map Item: title=\"USA time zones and traffic counts WebMap\">\n"
248+
]
275249
}
276250
],
277251
"source": [
@@ -280,17 +254,16 @@
280254
" 'tags':['automation', 'python']}\n",
281255
"\n",
282256
"webmap_item = usa_map.save(webmap_properties, \n",
283-
" # thumbnail='./webmap_thumbnail.png', \n",
284-
" # folder='webmaps'\n",
285-
" )\n",
257+
" thumbnail='./webmap_thumbnail.png', \n",
258+
" folder='webmaps')\n",
286259
"print(webmap_item)"
287260
]
288261
},
289262
{
290263
"cell_type": "markdown",
291264
"metadata": {},
292265
"source": [
293-
"You can use this web map back in the notebook, or in any ArcGIS app capable of rendering web maps. To learn how you can use this read this web map using the Python API, refer to the guide's following notebooks."
266+
"You can use this web map back in the notebook or in any ArcGIS app capable of rendering web maps. To learn how you can read this web map using the Python API, refer to the other parts of this notebook guide series."
294267
]
295268
},
296269
{
@@ -299,7 +272,7 @@
299272
"source": [
300273
"## The Object Model Diagram of the widgets module\n",
301274
"\n",
302-
"Any map widget instance is of the `arcgis.widgets.MapView` class, based of `ipywidgets.widgets.domwidget.DOMWidget`, and the `arcgis.widgets.MapView` class resides inside the `arcgis.widgets` module."
275+
"Any map widget instance is of the `arcgis.widgets.MapView` class, based on `ipywidgets.widgets.domwidget.DOMWidget`. The `arcgis.widgets.MapView` class resides inside the `arcgis.widgets` module."
303276
]
304277
},
305278
{
@@ -331,7 +304,7 @@
331304
"source": [
332305
"## Conclusions\n",
333306
"\n",
334-
"In Part 1 of this guide series, we have explored the basic concepts and usage of web maps, the correlation between `mapping` and `widgets` modules, and quickly walked through some starting examples of visualizing a map in the widget. In the following chapters of the guide series, we will discuss more advanced topics of mapping and map widgets."
307+
"In Part 1 of this guide series, we have explored the basic concepts and uses of web maps, the correlation between `mapping` and `widgets` modules, and quickly walked through some starting examples of visualizing a map in the widget. In the following chapters of this guide series, we will discuss more advanced topics of mapping and map widgets."
335308
]
336309
},
337310
{
@@ -344,7 +317,7 @@
344317
],
345318
"metadata": {
346319
"kernelspec": {
347-
"display_name": "Python 3",
320+
"display_name": "Python 3 (ipykernel)",
348321
"language": "python",
349322
"name": "python3"
350323
},
@@ -358,7 +331,7 @@
358331
"name": "python",
359332
"nbconvert_exporter": "python",
360333
"pygments_lexer": "ipython3",
361-
"version": "3.7.10"
334+
"version": "3.7.11"
362335
},
363336
"toc": {
364337
"base_numbering": 1,

0 commit comments

Comments
 (0)