Skip to content

Commit d4ca390

Browse files
authored
Merge pull request Esri#896 from priyankatuteja/power_users_updates
Power users sample updates
2 parents 6b52493 + b06a993 commit d4ca390

6 files changed

+177
-176
lines changed

samples/02_power_users_developers/building_a_change_detection_app_using_jupyter_dashboard.ipynb

Lines changed: 15 additions & 19 deletions
Large diffs are not rendered by default.

samples/02_power_users_developers/jupyter_dashboard_for_raster_analytics.ipynb

Lines changed: 21 additions & 32 deletions
Large diffs are not rendered by default.

samples/02_power_users_developers/openstreetmap_exploration.ipynb

Lines changed: 46 additions & 75 deletions
Large diffs are not rendered by default.

samples/02_power_users_developers/population_exploration_dashboard.ipynb

Lines changed: 26 additions & 3 deletions
Large diffs are not rendered by default.

samples/02_power_users_developers/tour_the_world_with_landsat_imagery_and_raster_functions.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@
383383
"name": "python",
384384
"nbconvert_exporter": "python",
385385
"pygments_lexer": "ipython3",
386-
"version": "3.6.9"
386+
"version": "3.7.9"
387387
},
388388
"widgets": {
389389
"state": {

samples/04_gis_analysts_data_scientists/visualize_monthly_changes_in_hirakund_reservoir_using_video.ipynb

Lines changed: 68 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,25 @@
5858
},
5959
{
6060
"cell_type": "code",
61-
"execution_count": 15,
61+
"execution_count": null,
62+
"metadata": {},
63+
"outputs": [],
64+
"source": [
65+
"!conda install -c anaconda pillow -y"
66+
]
67+
},
68+
{
69+
"cell_type": "code",
70+
"execution_count": null,
71+
"metadata": {},
72+
"outputs": [],
73+
"source": [
74+
"!conda install -c conda-forge imageio -y"
75+
]
76+
},
77+
{
78+
"cell_type": "code",
79+
"execution_count": 1,
6280
"metadata": {},
6381
"outputs": [],
6482
"source": [
@@ -71,7 +89,7 @@
7189
"\n",
7290
"import arcgis\n",
7391
"from arcgis.gis import GIS\n",
74-
"from arcgis import geometry\n",
92+
"from arcgis import geometry, geocode\n",
7593
"from arcgis.raster.functions import apply"
7694
]
7795
},
@@ -84,7 +102,7 @@
84102
},
85103
{
86104
"cell_type": "code",
87-
"execution_count": 4,
105+
"execution_count": null,
88106
"metadata": {},
89107
"outputs": [],
90108
"source": [
@@ -107,7 +125,7 @@
107125
},
108126
{
109127
"cell_type": "code",
110-
"execution_count": 5,
128+
"execution_count": 7,
111129
"metadata": {},
112130
"outputs": [
113131
{
@@ -125,7 +143,7 @@
125143
" </a>\n",
126144
" <br/>Landsat multispectral and multitemporal imagery with on-the-fly renderings and indices for visualization and analysis. The Landsat 8 imagery in this layer is updated daily and is directly sourced from the Landsat on AWS collection.<img src='https://geosaurus.maps.arcgis.com/home/js/jsapi/esri/css/images/item_type_icons/imagery16.png' style=\"vertical-align:middle;\">Imagery Layer by esri\n",
127145
" <br/>Last Modified: December 19, 2019\n",
128-
" <br/>0 comments, 259,890 views\n",
146+
" <br/>0 comments, 378,680 views\n",
129147
" </div>\n",
130148
" </div>\n",
131149
" "
@@ -134,7 +152,7 @@
134152
"<Item title:\"Multispectral Landsat\" type:Imagery Layer owner:esri>"
135153
]
136154
},
137-
"execution_count": 5,
155+
"execution_count": 7,
138156
"metadata": {},
139157
"output_type": "execute_result"
140158
}
@@ -178,6 +196,24 @@
178196
"rgb_collection = apply(landsat, 'Natural Color with DRA')"
179197
]
180198
},
199+
{
200+
"cell_type": "code",
201+
"execution_count": null,
202+
"metadata": {},
203+
"outputs": [],
204+
"source": [
205+
"g = geocode('Hirakund reservoir, Odisha', out_sr=3857)[0]"
206+
]
207+
},
208+
{
209+
"cell_type": "code",
210+
"execution_count": null,
211+
"metadata": {},
212+
"outputs": [],
213+
"source": [
214+
"extent = g.get('extent')"
215+
]
216+
},
181217
{
182218
"cell_type": "code",
183219
"execution_count": 14,
@@ -198,54 +234,50 @@
198234
}
199235
],
200236
"source": [
201-
"m = gis.map('Hirakund reservoir, Odisha', 10)\n",
202-
"m.basemap = 'imagery'\n",
203-
"\n",
237+
"m = gis.map()\n",
238+
"m.basemap = 'satellite'\n",
239+
"m.extent = extent\n",
204240
"m"
205241
]
206242
},
207243
{
208-
"cell_type": "code",
209-
"execution_count": 7,
244+
"cell_type": "markdown",
210245
"metadata": {},
211-
"outputs": [
212-
{
213-
"data": {
214-
"text/plain": [
215-
"{'spatialReference': {'latestWkid': 3857, 'wkid': 102100},\n",
216-
" 'xmin': 9251479.106444037,\n",
217-
" 'ymin': 2433602.2844587043,\n",
218-
" 'xmax': 9401907.17810932,\n",
219-
" 'ymax': 2494751.907086869}"
220-
]
221-
},
222-
"execution_count": 7,
223-
"metadata": {},
224-
"output_type": "execute_result"
225-
}
226-
],
227246
"source": [
228-
"extent = m.extent\n",
229-
"extent"
247+
"## Function to create collection of images with desired time intervals"
230248
]
231249
},
232250
{
233251
"cell_type": "markdown",
234252
"metadata": {},
235253
"source": [
236-
"## Function to create collection of images with desired time intervals"
254+
"The function below creates an array of images with the desired time intervals. If a user specifies 'm' then the images in the selected collection will be consolidated on a monthly basis i.e. all the images of the specified extent will be mosaicked monthly and if the user specifies 'y' as the interval then the images in the selected collection will be consolidated on yearly basis."
237255
]
238256
},
239257
{
240-
"cell_type": "markdown",
258+
"cell_type": "code",
259+
"execution_count": 12,
241260
"metadata": {},
261+
"outputs": [],
242262
"source": [
243-
"The function below creates an array of images with the desired time intervals. If a user specifies 'm' then the images in the selected collection will be consolidated on a monthly basis i.e. all the images of the specified extent will be mosaicked monthly and if the user specifies 'y' as the interval then the images in the selected collection will be consolidated on yearly basis."
263+
"from functools import lru_cache\n",
264+
"\n",
265+
"@lru_cache(maxsize=50)\n",
266+
"def load_font():\n",
267+
" try:\n",
268+
" if system()=='Windows':\n",
269+
" return ImageFont.truetype(\"arial.ttf\", 30)\n",
270+
" elif system()=='Linux':\n",
271+
" return ImageFont.truetype(\"~/.fonts/truetype/dejavu/DejaVuSans.ttf\", 30)\n",
272+
" else:\n",
273+
" return ImageFont.truetype(\"Arial.ttf\", 30)\n",
274+
" except:\n",
275+
" return ImageFont.load_default()"
244276
]
245277
},
246278
{
247279
"cell_type": "code",
248-
"execution_count": 10,
280+
"execution_count": 13,
249281
"metadata": {},
250282
"outputs": [],
251283
"source": [
@@ -263,12 +295,7 @@
263295
" save_folder='.', \n",
264296
" save_file=img_name)\n",
265297
" img = Image.open(img_name).convert('RGB')\n",
266-
" if system()=='Windows':\n",
267-
" font = ImageFont.truetype(\"arial.ttf\", 30)\n",
268-
" elif system()=='Linux':\n",
269-
" font = ImageFont.truetype(\"~/.fonts/truetype/dejavu/DejaVuSans.ttf\", 30)\n",
270-
" else:\n",
271-
" font = ImageFont.truetype(\"Arial.ttf\", 30)\n",
298+
" font = load_font()\n",
272299
" draw = ImageDraw.Draw(img)\n",
273300
" draw.text((550, 0),str(j)+\"-\"+str(i),(255,255,255),font=font)\n",
274301
" images.append(img)\n",
@@ -285,12 +312,7 @@
285312
" save_folder='.', \n",
286313
" save_file=img_name)\n",
287314
" img = Image.open(img_name).convert('RGB')\n",
288-
" if system()=='Windows':\n",
289-
" font = ImageFont.truetype(\"arial.ttf\", 30)\n",
290-
" elif system()=='Linux':\n",
291-
" font = ImageFont.truetype(\"~/.fonts/truetype/dejavu/DejaVuSans.ttf\", 30)\n",
292-
" else:\n",
293-
" font = ImageFont.truetype(\"Arial.ttf\", 30)\n",
315+
" font = load_font()\n",
294316
" draw = ImageDraw.Draw(img)\n",
295317
" draw.text((550, 0),str(i),(255,255,255),font=font) \n",
296318
" images.append(img)\n",
@@ -400,7 +422,7 @@
400422
"name": "python",
401423
"nbconvert_exporter": "python",
402424
"pygments_lexer": "ipython3",
403-
"version": "3.6.9"
425+
"version": "3.7.9"
404426
}
405427
},
406428
"nbformat": 4,

0 commit comments

Comments
 (0)