|
29 | 29 | },
|
30 | 30 | {
|
31 | 31 | "cell_type": "code",
|
32 |
| - "execution_count": 16, |
| 32 | + "execution_count": 17, |
33 | 33 | "metadata": {},
|
34 |
| - "outputs": [ |
35 |
| - { |
36 |
| - "name": "stdout", |
37 |
| - "output_type": "stream", |
38 |
| - "text": [ |
39 |
| - "Enter password, please: ········\n" |
40 |
| - ] |
41 |
| - } |
42 |
| - ], |
| 34 | + "outputs": [], |
43 | 35 | "source": [
|
44 |
| - "import getpass\n", |
45 |
| - "\n", |
46 |
| - "password = getpass.getpass(\"Enter password, please: \")\n", |
47 |
| - "gis = GIS('https://arcgis.com', 'username', password)" |
| 36 | + "from arcgis.gis import GIS\n", |
| 37 | + "import os" |
| 38 | + ] |
| 39 | + }, |
| 40 | + { |
| 41 | + "cell_type": "markdown", |
| 42 | + "metadata": {}, |
| 43 | + "source": [ |
| 44 | + "To create the GIS object, we pass your profile that contains the url and your login credentials. Please replace the credentials below with that of your org. To learn more about profiles, see [here](https://developers.arcgis.com/python/guide/working-with-different-authentication-schemes/#Storing-your-credentialls-locally)." |
48 | 45 | ]
|
49 | 46 | },
|
50 | 47 | {
|
51 | 48 | "cell_type": "code",
|
52 |
| - "execution_count": 17, |
53 |
| - "metadata": { |
54 |
| - "collapsed": true |
55 |
| - }, |
| 49 | + "execution_count": 18, |
| 50 | + "metadata": {}, |
| 51 | + "outputs": [], |
| 52 | + "source": [ |
| 53 | + "gis = GIS(profile='your_online_profile')" |
| 54 | + ] |
| 55 | + }, |
| 56 | + { |
| 57 | + "cell_type": "code", |
| 58 | + "execution_count": 10, |
| 59 | + "metadata": {}, |
56 | 60 | "outputs": [],
|
57 | 61 | "source": [
|
58 | 62 | "parks_properties = {'title': 'Parks and Open Space',\n",
|
59 |
| - " 'tags': 'parks, open data, devlabs',\n", |
60 |
| - " 'type': 'Shapefile'}\n", |
61 |
| - "parks_shp = gis.content.add(parks_properties,\n", |
62 |
| - " data='./LA_Hub_datasets/Parks_and_Open_Space.zip')" |
| 63 | + " 'tags': 'parks, open data, devlabs',\n", |
| 64 | + " 'type': 'Shapefile'}\n", |
| 65 | + "data_path = os.path.join('.', 'data', 'LA_Hub_datasets', 'Parks_and_Open_Space.zip')" |
63 | 66 | ]
|
64 | 67 | },
|
65 | 68 | {
|
66 | 69 | "cell_type": "code",
|
67 |
| - "execution_count": 18, |
| 70 | + "execution_count": 19, |
| 71 | + "metadata": {}, |
| 72 | + "outputs": [], |
| 73 | + "source": [ |
| 74 | + "parks_shp = gis.content.add(parks_properties, data=data_path)" |
| 75 | + ] |
| 76 | + }, |
| 77 | + { |
| 78 | + "cell_type": "code", |
| 79 | + "execution_count": 20, |
68 | 80 | "metadata": {},
|
69 | 81 | "outputs": [
|
70 | 82 | {
|
71 | 83 | "data": {
|
72 | 84 | "text/html": [
|
73 | 85 | "<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",
|
74 | 86 | " <div class=\"item_left\" style=\"width: 210px; float: left;\">\n",
|
75 |
| - " <a href='https://arcgis.com/home/item.html?id=7d848422761f4d78bf986f9a1bc7ad1b' target='_blank'>\n", |
| 87 | + " <a href='https://geosaurus.maps.arcgis.com/home/item.html?id=7e7d17040fdf4b35b2e5e5fef7eed7cf' target='_blank'>\n", |
76 | 88 | " <img src='http://static.arcgis.com/images/desktopapp.png' class=\"itemThumbnail\">\n",
|
77 | 89 | " </a>\n",
|
78 | 90 | " </div>\n",
|
79 | 91 | "\n",
|
80 | 92 | " <div class=\"item_right\" style=\"float: none; width: auto; overflow: hidden;\">\n",
|
81 |
| - " <a href='https://arcgis.com/home/item.html?id=7d848422761f4d78bf986f9a1bc7ad1b' target='_blank'><b>Parks and Open Space</b>\n", |
| 93 | + " <a href='https://geosaurus.maps.arcgis.com/home/item.html?id=7e7d17040fdf4b35b2e5e5fef7eed7cf' target='_blank'><b>Parks and Open Space</b>\n", |
82 | 94 | " </a>\n",
|
83 |
| - " <br/><img src='https://arcgis.com/home/js/jsapi/esri/css/images/item_type_icons/datafiles16.png' style=\"vertical-align:middle;\">Shapefile by johnnyDev\n", |
84 |
| - " <br/>Last Modified: September 28, 2017\n", |
| 95 | + " <br/><img src='https://geosaurus.maps.arcgis.com/home/js/jsapi/esri/css/images/item_type_icons/datafiles16.png' style=\"vertical-align:middle;\">Shapefile by arcgis_python\n", |
| 96 | + " <br/>Last Modified: April 11, 2019\n", |
85 | 97 | " <br/>0 comments, 0 views\n",
|
86 | 98 | " </div>\n",
|
87 | 99 | " </div>\n",
|
88 | 100 | " "
|
89 | 101 | ],
|
90 | 102 | "text/plain": [
|
91 |
| - "<Item title:\"Parks and Open Space\" type:Shapefile owner:johnnyDev>" |
| 103 | + "<Item title:\"Parks and Open Space\" type:Shapefile owner:arcgis_python>" |
92 | 104 | ]
|
93 | 105 | },
|
94 |
| - "execution_count": 18, |
| 106 | + "execution_count": 20, |
95 | 107 | "metadata": {},
|
96 | 108 | "output_type": "execute_result"
|
97 | 109 | }
|
|
102 | 114 | },
|
103 | 115 | {
|
104 | 116 | "cell_type": "code",
|
105 |
| - "execution_count": 19, |
106 |
| - "metadata": { |
107 |
| - "collapsed": true |
108 |
| - }, |
| 117 | + "execution_count": 21, |
| 118 | + "metadata": {}, |
109 | 119 | "outputs": [],
|
110 | 120 | "source": [
|
111 | 121 | "parks_feature_layer = parks_shp.publish()"
|
112 | 122 | ]
|
113 | 123 | },
|
114 | 124 | {
|
115 | 125 | "cell_type": "code",
|
116 |
| - "execution_count": 20, |
| 126 | + "execution_count": 22, |
117 | 127 | "metadata": {},
|
118 | 128 | "outputs": [
|
119 | 129 | {
|
120 | 130 | "data": {
|
121 | 131 | "text/plain": [
|
122 |
| - "'https://services1.arcgis.com/uRIm5IkWjDXybgFb/arcgis/rest/services/Parks_and_Open_Space/FeatureServer'" |
| 132 | + "'https://services7.arcgis.com/JEwYeAy2cc8qOe3o/arcgis/rest/services/Parks_and_Open_Space/FeatureServer'" |
123 | 133 | ]
|
124 | 134 | },
|
125 |
| - "execution_count": 20, |
| 135 | + "execution_count": 22, |
126 | 136 | "metadata": {},
|
127 | 137 | "output_type": "execute_result"
|
128 | 138 | }
|
|
135 | 145 | "metadata": {
|
136 | 146 | "anaconda-cloud": {},
|
137 | 147 | "kernelspec": {
|
138 |
| - "display_name": "Python [default]", |
| 148 | + "display_name": "Python 3", |
139 | 149 | "language": "python",
|
140 | 150 | "name": "python3"
|
141 | 151 | },
|
|
149 | 159 | "name": "python",
|
150 | 160 | "nbconvert_exporter": "python",
|
151 | 161 | "pygments_lexer": "ipython3",
|
152 |
| - "version": "3.5.3" |
| 162 | + "version": "3.7.2" |
153 | 163 | }
|
154 | 164 | },
|
155 | 165 | "nbformat": 4,
|
|
0 commit comments