Skip to content

Commit af63a15

Browse files
jyaistMaprohitgeo
authored andcommitted
Adding Display Web Map solution notebook (Esri#142)
* final solution for display-web-map lab * initial commmit for display web map lab. * added challenge cells and matched web map name to md file.
1 parent ef8da75 commit af63a15

File tree

2 files changed

+207
-15
lines changed

2 files changed

+207
-15
lines changed

labs/create_data.ipynb

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,16 @@
2525
},
2626
{
2727
"cell_type": "code",
28-
"execution_count": 2,
28+
"execution_count": 10,
2929
"metadata": {},
3030
"outputs": [
3131
{
3232
"data": {
3333
"text/plain": [
34-
"[<Item title:\"Griffith Park Access2\" type:Feature Layer Collection owner:johnnyDev>]"
34+
"[<Item title:\"Griffith Park Access\" type:Feature Layer Collection owner:johnnyDev>]"
3535
]
3636
},
37-
"execution_count": 2,
37+
"execution_count": 10,
3838
"metadata": {},
3939
"output_type": "execute_result"
4040
}
@@ -47,7 +47,7 @@
4747
},
4848
{
4949
"cell_type": "code",
50-
"execution_count": 3,
50+
"execution_count": 12,
5151
"metadata": {},
5252
"outputs": [
5353
{
@@ -56,7 +56,7 @@
5656
"'griffith_park_access2'"
5757
]
5858
},
59-
"execution_count": 3,
59+
"execution_count": 12,
6060
"metadata": {},
6161
"output_type": "execute_result"
6262
}
@@ -70,7 +70,7 @@
7070
},
7171
{
7272
"cell_type": "code",
73-
"execution_count": 4,
73+
"execution_count": 13,
7474
"metadata": {},
7575
"outputs": [
7676
{
@@ -91,7 +91,7 @@
9191
},
9292
{
9393
"cell_type": "code",
94-
"execution_count": 5,
94+
"execution_count": 14,
9595
"metadata": {
9696
"collapsed": true
9797
},
@@ -117,13 +117,13 @@
117117
},
118118
{
119119
"cell_type": "code",
120-
"execution_count": 6,
120+
"execution_count": 15,
121121
"metadata": {},
122122
"outputs": [
123123
{
124124
"data": {
125125
"application/vnd.jupyter.widget-view+json": {
126-
"model_id": "57be67419bbb49babb30726e9d29aa91"
126+
"model_id": "8d6be30f76c0426690756959e8b48c06"
127127
}
128128
},
129129
"metadata": {},
@@ -133,9 +133,9 @@
133133
"name": "stdout",
134134
"output_type": "stream",
135135
"text": [
136-
"{'y': 4031785.200371807, 'type': 'point', 'spatialReference': {'latestWkid': 3857, 'wkid': 102100}, 'x': -13174326.588164143}\n",
137-
"{'y': 4039276.029143757, 'type': 'point', 'spatialReference': {'latestWkid': 3857, 'wkid': 102100}, 'x': -13181205.920709811}\n",
138-
"{'y': 4024447.2456564275, 'type': 'point', 'spatialReference': {'latestWkid': 3857, 'wkid': 102100}, 'x': -13167447.255618475}\n"
136+
"{'type': 'point', 'x': -13165150.322102066, 'y': 4036312.1838385323, 'spatialReference': {'latestWkid': 3857, 'wkid': 102100}}\n",
137+
"{'type': 'point', 'x': -13180705.257358078, 'y': 4031878.836197998, 'spatialReference': {'latestWkid': 3857, 'wkid': 102100}}\n",
138+
"{'type': 'point', 'x': -13188540.052757299, 'y': 4027101.521930181, 'spatialReference': {'latestWkid': 3857, 'wkid': 102100}}\n"
139139
]
140140
}
141141
],
@@ -146,7 +146,7 @@
146146
},
147147
{
148148
"cell_type": "code",
149-
"execution_count": 7,
149+
"execution_count": 16,
150150
"metadata": {
151151
"collapsed": true
152152
},
@@ -157,7 +157,7 @@
157157
},
158158
{
159159
"cell_type": "code",
160-
"execution_count": 8,
160+
"execution_count": 17,
161161
"metadata": {
162162
"collapsed": true
163163
},
@@ -168,7 +168,7 @@
168168
},
169169
{
170170
"cell_type": "code",
171-
"execution_count": 9,
171+
"execution_count": 18,
172172
"metadata": {
173173
"collapsed": true
174174
},

labs/display-web-map.ipynb

Lines changed: 192 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,192 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"metadata": {},
6+
"source": [
7+
"# Display Web Map ArcGIS DevLab\n",
8+
"This is the completed solution for the [Display a Web Map](https://developers.arcgis.com/labs/data/python/display-webmap/) ArcGIS DevLab. [ArcGIS DevLabs](https://developers.arcgis.com/labs/) are short introductory tutorials to guide you through the three phases of building geospatial apps: Data, Design, Develop"
9+
]
10+
},
11+
{
12+
"cell_type": "code",
13+
"execution_count": 1,
14+
"metadata": {
15+
"collapsed": true
16+
},
17+
"outputs": [],
18+
"source": [
19+
"from arcgis.gis import GIS\n",
20+
"\n",
21+
"gis = GIS(\"https://www.arcgis.com\")"
22+
]
23+
},
24+
{
25+
"cell_type": "markdown",
26+
"metadata": {},
27+
"source": [
28+
"Let's search for a Los Angeles Parks and Trails Map. "
29+
]
30+
},
31+
{
32+
"cell_type": "code",
33+
"execution_count": 2,
34+
"metadata": {},
35+
"outputs": [
36+
{
37+
"data": {
38+
"text/plain": [
39+
"[<Item title:\"Tree Canopy by City in Minnesota\" type:Web Map owner:vikalpa>,\n",
40+
" <Item title:\"San Diego Shortlist-Copy\" type:Web Map owner:opsdashboarddemo>,\n",
41+
" <Item title:\"LA Parks and Trails Map (styled with popups)c\" type:Web Map owner:cheangerlove>,\n",
42+
" <Item title:\"Location Map Telematica\" type:Web Map owner:roberto.arbanil>,\n",
43+
" <Item title:\"Vaals6\" type:Web Map owner:haicao1975>,\n",
44+
" <Item title:\"ADFCA Short List Map Story\" type:Web Map owner:developer5>,\n",
45+
" <Item title:\"San Diego Places To Go-复制\" type:Web Map owner:win_001>,\n",
46+
" <Item title:\"San Diego Places To Go-Copy\" type:Web Map owner:hayam_osama>,\n",
47+
" <Item title:\"Vaals9\" type:Web Map owner:haicao1975>,\n",
48+
" <Item title:\"San Diego Shortlist-Copia\" type:Web Map owner:paoloprova>]"
49+
]
50+
},
51+
"execution_count": 2,
52+
"metadata": {},
53+
"output_type": "execute_result"
54+
}
55+
],
56+
"source": [
57+
"webmaps = gis.content.search(query=\"LA Parks and Trails *\", item_type=\"Web Map\")\n",
58+
"webmaps"
59+
]
60+
},
61+
{
62+
"cell_type": "markdown",
63+
"metadata": {},
64+
"source": [
65+
"The index position for the LA Parks and Trails Map in your search list may vary from the example."
66+
]
67+
},
68+
{
69+
"cell_type": "code",
70+
"execution_count": 3,
71+
"metadata": {},
72+
"outputs": [
73+
{
74+
"data": {
75+
"text/html": [
76+
"<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",
77+
" <div class=\"item_left\" style=\"width: 210px; float: left;\">\n",
78+
" <a href='https://www.arcgis.com/home/item.html?id=77919fc65fcb4e2eb35d6bfd3217d037' target='_blank'>\n",
79+
" <img src='https://www.arcgis.com/sharing/rest//content/items/77919fc65fcb4e2eb35d6bfd3217d037/info/thumbnail/ago_downloaded.png' class=\"itemThumbnail\">\n",
80+
" </a>\n",
81+
" </div>\n",
82+
"\n",
83+
" <div class=\"item_right\" style=\"float: none; width: auto; overflow: hidden;\">\n",
84+
" <a href='https://www.arcgis.com/home/item.html?id=77919fc65fcb4e2eb35d6bfd3217d037' target='_blank'><b>LA Parks and Trails Map (styled with popups)c</b>\n",
85+
" </a>\n",
86+
" <br/>Trails and parks in the LA area (styled with popups)<img src='https://www.arcgis.com/home/js/jsapi/esri/css/images/item_type_icons/maps16.png' style=\"vertical-align:middle;\">Web Map by cheangerlove\n",
87+
" <br/>Last Modified: July 10, 2017\n",
88+
" <br/>0 comments, 10 views\n",
89+
" </div>\n",
90+
" </div>\n",
91+
" "
92+
],
93+
"text/plain": [
94+
"<Item title:\"LA Parks and Trails Map (styled with popups)c\" type:Web Map owner:cheangerlove>"
95+
]
96+
},
97+
"execution_count": 3,
98+
"metadata": {},
99+
"output_type": "execute_result"
100+
}
101+
],
102+
"source": [
103+
"webmap = webmaps[2]\n",
104+
"webmap"
105+
]
106+
},
107+
{
108+
"cell_type": "code",
109+
"execution_count": 6,
110+
"metadata": {},
111+
"outputs": [
112+
{
113+
"data": {
114+
"application/vnd.jupyter.widget-view+json": {
115+
"model_id": "c90306bdb16442178b019338eec3fb33"
116+
}
117+
},
118+
"metadata": {},
119+
"output_type": "display_data"
120+
}
121+
],
122+
"source": [
123+
"from arcgis.mapping import WebMap\n",
124+
"la_parks_trails = WebMap(webmap)\n",
125+
"la_parks_trails"
126+
]
127+
},
128+
{
129+
"cell_type": "code",
130+
"execution_count": 7,
131+
"metadata": {},
132+
"outputs": [
133+
{
134+
"name": "stdout",
135+
"output_type": "stream",
136+
"text": [
137+
"The webmap has 3 layers.\n"
138+
]
139+
}
140+
],
141+
"source": [
142+
"op_layers = la_parks_trails['operationalLayers']\n",
143+
"print(\"The webmap has {} layers.\".format(len(op_layers)))"
144+
]
145+
},
146+
{
147+
"cell_type": "code",
148+
"execution_count": 8,
149+
"metadata": {},
150+
"outputs": [
151+
{
152+
"name": "stdout",
153+
"output_type": "stream",
154+
"text": [
155+
"Parks_and_Open_Space_8268\n",
156+
"\thttps://services3.arcgis.com/GVgbJbqm8hXASVYi/arcgis/rest/services/Parks_and_Open_Space/FeatureServer/0\n",
157+
"Trails_7558\n",
158+
"\thttps://services3.arcgis.com/GVgbJbqm8hXASVYi/arcgis/rest/services/Trails/FeatureServer/0\n",
159+
"Trailheads_8053\n",
160+
"\thttps://services3.arcgis.com/GVgbJbqm8hXASVYi/arcgis/rest/services/Trailheads/FeatureServer/0\n"
161+
]
162+
}
163+
],
164+
"source": [
165+
"for lyr in la_prk_trails_webmap['operationalLayers']:\n",
166+
" print(\"{}\\n\\t{}\".format(lyr['id'], lyr['url']))"
167+
]
168+
}
169+
],
170+
"metadata": {
171+
"anaconda-cloud": {},
172+
"kernelspec": {
173+
"display_name": "Python [default]",
174+
"language": "python",
175+
"name": "python3"
176+
},
177+
"language_info": {
178+
"codemirror_mode": {
179+
"name": "ipython",
180+
"version": 3
181+
},
182+
"file_extension": ".py",
183+
"mimetype": "text/x-python",
184+
"name": "python",
185+
"nbconvert_exporter": "python",
186+
"pygments_lexer": "ipython3",
187+
"version": "3.5.3"
188+
}
189+
},
190+
"nbformat": 4,
191+
"nbformat_minor": 1
192+
}

0 commit comments

Comments
 (0)