|
21 | 21 | "cell_type": "markdown",
|
22 | 22 | "metadata": {},
|
23 | 23 | "source": [
|
24 |
| - "## Using the map widget\n", |
25 |
| - "The `GIS` object includes a map widget for displaying geographic locations, visualizing GIS content, as well as the results of your analysis. 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:" |
| 24 | + "## The map widget\n", |
| 25 | + "The `GIS` object includes a map widget for displaying geographic locations, visualizing GIS content, as well as the results of your analysis. 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:" |
26 | 26 | ]
|
27 | 27 | },
|
28 | 28 | {
|
|
236 | 236 | "To see which basemaps are available for use with the map widget, use the Map's `basemap` property to initialize a BasemapManager, and then use the `basemaps` property to return a list of basemaps currently configured with the organization:"
|
237 | 237 | ]
|
238 | 238 | },
|
| 239 | + { |
| 240 | + "cell_type": "code", |
| 241 | + "execution_count": 5, |
| 242 | + "metadata": {}, |
| 243 | + "outputs": [], |
| 244 | + "source": [ |
| 245 | + "from arcgis.gis import GIS\n", |
| 246 | + "gis = GIS(profile=\"your_online_profile\")" |
| 247 | + ] |
| 248 | + }, |
239 | 249 | {
|
240 | 250 | "cell_type": "code",
|
241 | 251 | "execution_count": 32,
|
|
388 | 398 | "See below for an animation preview of some of the basemaps listed above:"
|
389 | 399 | ]
|
390 | 400 | },
|
391 |
| - { |
392 |
| - "cell_type": "code", |
393 |
| - "execution_count": 5, |
394 |
| - "metadata": {}, |
395 |
| - "outputs": [], |
396 |
| - "source": [ |
397 |
| - "from arcgis.gis import GIS\n", |
398 |
| - "gis = GIS()" |
399 |
| - ] |
400 |
| - }, |
401 | 401 | {
|
402 | 402 | "cell_type": "code",
|
403 | 403 | "execution_count": 6,
|
|
562 | 562 | "cell_type": "markdown",
|
563 | 563 | "metadata": {},
|
564 | 564 | "source": [
|
565 |
| - "Read more about 3D mode by reading the [advanced map widget useage](../advanced-map-widget-useage) guide page, or by reading the [API reference](https://developers.arcgis.com/python/api-reference/arcgis.widgets.html#mapview)." |
| 565 | + "Read more about 3D mode by reading the [advanced map widget useage](../advanced-map-widget-usage) guide page, or by reading the [API reference](https://developers.arcgis.com/python/api-reference/arcgis.map.toc.html#scene)." |
566 | 566 | ]
|
567 | 567 | },
|
568 | 568 | {
|
569 | 569 | "cell_type": "markdown",
|
570 | 570 | "metadata": {},
|
571 | 571 | "source": [
|
572 | 572 | "## Adding layers to the map\n",
|
573 |
| - "An important functionality of the map widget is its ability to add and render GIS layers. To a layer call the .content.add()` method and pass the layer object as an argument." |
| 573 | + "An important functionality of the map widget is its ability to add and render GIS layers. To add a layer call the `.content.add()` method and pass the layer object as an argument." |
574 | 574 | ]
|
575 | 575 | },
|
576 | 576 | {
|
|
604 | 604 | "metadata": {},
|
605 | 605 | "source": [
|
606 | 606 | "### Adding `Item` objects to the map\n",
|
607 |
| - "You can add `Item` objects to a map by passing it to the .content.add()` method." |
| 607 | + "You can add `Item` objects to a map by passing it to the `.content.add()` method." |
608 | 608 | ]
|
609 | 609 | },
|
610 | 610 | {
|
|
717 | 717 | }
|
718 | 718 | ],
|
719 | 719 | "source": [
|
720 |
| - "fimg_map = gis.map()\n", |
| 720 | + "img_map = gis.map()\n", |
721 | 721 | "img_map"
|
722 | 722 | ]
|
723 | 723 | },
|
|
783 | 783 | "metadata": {},
|
784 | 784 | "source": [
|
785 | 785 | "## Listing the layers added to the map\n",
|
786 |
| - "You can list the layers added to be map using the `layers` property." |
| 786 | + "You can list the layers added to the map using the _MapContent_ (accessed from the _content_ property of a map object) object's `layers` property." |
787 | 787 | ]
|
788 | 788 | },
|
789 | 789 | {
|
|
807 | 807 | ]
|
808 | 808 | },
|
809 | 809 | {
|
810 |
| - "cell_type": "code", |
811 |
| - "execution_count": 180, |
| 810 | + "cell_type": "markdown", |
812 | 811 | "metadata": {},
|
813 |
| - "outputs": [ |
814 |
| - { |
815 |
| - "data": { |
816 |
| - "text/plain": [ |
817 |
| - "[<FeatureLayer url:\"https://services.arcgis.com/P3ePLMYs2RVChkJx/arcgis/rest/services/World_Time_Zones/FeatureServer/0\">]" |
818 |
| - ] |
819 |
| - }, |
820 |
| - "execution_count": 180, |
821 |
| - "metadata": {}, |
822 |
| - "output_type": "execute_result" |
823 |
| - } |
824 |
| - ], |
825 | 812 | "source": [
|
826 |
| - "usa_map.content.layers" |
| 813 | + "## Removing layers from the map\n", |
| 814 | + "To remove one or more layers, call the `remove()` method on the _Map_ object, and pass a layer index value (or list of indexes) of the layer to remove. To get a list of valid layers that can be removed and their index positions, enumerate the _map.content.layers_ output:.\n", |
| 815 | + "\n", |
| 816 | + "The code below shows how to remove the timezone layers from the map we drew earlier:" |
827 | 817 | ]
|
828 | 818 | },
|
829 | 819 | {
|
830 |
| - "cell_type": "markdown", |
| 820 | + "cell_type": "code", |
| 821 | + "execution_count": 2, |
831 | 822 | "metadata": {},
|
| 823 | + "outputs": [ |
| 824 | + { |
| 825 | + "name": "stdout", |
| 826 | + "output_type": "stream", |
| 827 | + "text": [ |
| 828 | + "0 <FeatureLayer url:\"https://services.arcgis.com/P3ePLMYs2RVChkJx/arcgis/rest/services/World_Time_Zones/FeatureServer/0\">\n" |
| 829 | + ] |
| 830 | + } |
| 831 | + ], |
832 | 832 | "source": [
|
833 |
| - "## Removing layers from the map\n", |
834 |
| - "To remove one or more layers, call the `remove_layers()` method and pass a list of layers that you want removed. To get a list of valid layers that can be removed, call the `layers` property as shown in the previous cell.\n", |
835 |
| - "\n", |
836 |
| - "The code below shows how to remove the timezone layers from the map we drew earlier:" |
| 833 | + "for idx,lyr in enumerate(usa_map.content.layers):\n", |
| 834 | + " print(f\"{idx:<6}{lyr}\")" |
837 | 835 | ]
|
838 | 836 | },
|
839 | 837 | {
|
|
943 | 941 | "metadata": {},
|
944 | 942 | "source": [
|
945 | 943 | "### Drawing `FeatureSet` objects on the map\n",
|
946 |
| - "In addition to sketches, you can send `FeatureSet` objects to the `draw()` method. This capability comes in handy as you can get a `FeatureSet` object through various different operations using the Python API. For instance, you can get results of a `geocoding` operation as a `FeatureSet`, results of a `query()` operation on a `FeatureLayer` as a `FeatureSet` that can you visualize on the map using the `draw()` method.\n", |
| 944 | + "In addition to sketches, you can send `FeatureSet` objects to the `draw()` method. This capability comes in handy as you can get a `FeatureSet` object through various different operations using the Python API. For instance, you can get results of a `geocoding` operation as a `FeatureSet` or the results of a `query()` operation on a `FeatureLayer` as a `FeatureSet` that can you visualize on the map using the `draw()` method and a defined symbol.\n", |
947 | 945 | "\n",
|
948 | 946 | "The snippet below geocodes the locations of a few capitol buildings in the USA."
|
949 | 947 | ]
|
|
999 | 997 | "metadata": {},
|
1000 | 998 | "source": [
|
1001 | 999 | "### Drawing with custom symbols\n",
|
1002 |
| - "While drawing a graphic, you can specify a custom symbol. Users of the Python API can make use of a custom [symbol selector web app]() and pick a symbol for point layers. For instance, you can pick a business marker symbol for the capitol buildings as shown below:" |
| 1000 | + "While drawing a graphic, you can specify a custom symbol. For instance, you can pick a business marker symbol from a url for the capitol buildings as shown below:" |
1003 | 1001 | ]
|
1004 | 1002 | },
|
1005 | 1003 | {
|
|
0 commit comments