Skip to content

Commit 461b8d0

Browse files
authored
Merge pull request #139 from mpayson/master
Thanks @mpayson
2 parents a8a765a + 703efe8 commit 461b8d0

File tree

1 file changed

+128
-0
lines changed

1 file changed

+128
-0
lines changed

labs/share_your_content.ipynb

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"metadata": {},
6+
"source": [
7+
"# Share Your Content ArcGIS Devlab\n",
8+
"\n",
9+
"This is the completed sample for the [Share your content](https://developers.arcgis.com/labs/data/python/share-your-content/) 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."
10+
]
11+
},
12+
{
13+
"cell_type": "markdown",
14+
"metadata": {},
15+
"source": [
16+
"### Important Note\n",
17+
"Please complete the [Create data lab](https://developers.arcgis.com/labs/data/python/create-data/) if you have not done so already. You will use the output feature layer from this lab to learn how to find and share an item."
18+
]
19+
},
20+
{
21+
"cell_type": "code",
22+
"execution_count": null,
23+
"metadata": {
24+
"collapsed": true
25+
},
26+
"outputs": [],
27+
"source": [
28+
"from arcgis.gis import *"
29+
]
30+
},
31+
{
32+
"cell_type": "markdown",
33+
"metadata": {},
34+
"source": [
35+
"Log into ArcGIS Online by making a GIS connection using your developer account. Replace `username` and `password` with your own credentials"
36+
]
37+
},
38+
{
39+
"cell_type": "code",
40+
"execution_count": null,
41+
"metadata": {
42+
"collapsed": true
43+
},
44+
"outputs": [],
45+
"source": [
46+
"dev_gis = GIS(\"https://www.arcgis.com\", \"username\", \"password\")"
47+
]
48+
},
49+
{
50+
"cell_type": "markdown",
51+
"metadata": {},
52+
"source": [
53+
"Search for the *Griffith Park Access* layer used in the [Create data lab](https://developers.arcgis.com/labs/data/python/create-data/) DevLab."
54+
]
55+
},
56+
{
57+
"cell_type": "code",
58+
"execution_count": null,
59+
"metadata": {
60+
"collapsed": true
61+
},
62+
"outputs": [],
63+
"source": [
64+
"feature_layer_srch_results = dev_gis.content.search(query='title: \"Griffith*\" AND type: \"Feature Service\"')\n",
65+
"feature_layer_srch_results"
66+
]
67+
},
68+
{
69+
"cell_type": "markdown",
70+
"metadata": {},
71+
"source": [
72+
"Retrieve the feature layer collection item from the list of results.\n",
73+
"To check the sharing permissions, click the *thumbnail* link to open the *Item Details* page and find *Shared with* under *Details* on the right."
74+
]
75+
},
76+
{
77+
"cell_type": "code",
78+
"execution_count": null,
79+
"metadata": {
80+
"collapsed": true
81+
},
82+
"outputs": [],
83+
"source": [
84+
"feature_layer_coll_item = feature_layer_srch_results[0]\n",
85+
"feature_layer_coll_item"
86+
]
87+
},
88+
{
89+
"cell_type": "markdown",
90+
"metadata": {},
91+
"source": [
92+
"Update the sharing permissions of the layer so that it's available to everyone. You can verify the update by refreshing the thumbnail link!"
93+
]
94+
},
95+
{
96+
"cell_type": "code",
97+
"execution_count": null,
98+
"metadata": {
99+
"collapsed": true
100+
},
101+
"outputs": [],
102+
"source": [
103+
"feature_layer_coll_item.share(everyone=True)"
104+
]
105+
}
106+
],
107+
"metadata": {
108+
"kernelspec": {
109+
"display_name": "Python 3",
110+
"language": "python",
111+
"name": "python3"
112+
},
113+
"language_info": {
114+
"codemirror_mode": {
115+
"name": "ipython",
116+
"version": 3
117+
},
118+
"file_extension": ".py",
119+
"mimetype": "text/x-python",
120+
"name": "python",
121+
"nbconvert_exporter": "python",
122+
"pygments_lexer": "ipython3",
123+
"version": "3.6.1"
124+
}
125+
},
126+
"nbformat": 4,
127+
"nbformat_minor": 2
128+
}

0 commit comments

Comments
 (0)