|
31 | 31 | },
|
32 | 32 | {
|
33 | 33 | "cell_type": "code",
|
34 |
| - "execution_count": 35, |
35 |
| - "metadata": {}, |
36 |
| - "outputs": [ |
37 |
| - { |
38 |
| - "name": "stdout", |
39 |
| - "output_type": "stream", |
40 |
| - "text": [ |
41 |
| - "Enter password, please: ········\n" |
42 |
| - ] |
43 |
| - } |
44 |
| - ], |
45 |
| - "source": [ |
46 |
| - "from arcgis.gis import GIS\n", |
47 |
| - "import getpass\n", |
48 |
| - "\n", |
49 |
| - "password = getpass.getpass(\"Enter password, please: \")\n", |
50 |
| - "gis = GIS('https://arcgis.com', 'username', password)" |
51 |
| - ] |
52 |
| - }, |
53 |
| - { |
54 |
| - "cell_type": "code", |
55 |
| - "execution_count": 6, |
| 34 | + "execution_count": 17, |
56 | 35 | "metadata": {},
|
57 | 36 | "outputs": [],
|
58 | 37 | "source": [
|
59 |
| - "parks_properties = {\n", |
60 |
| - " 'title': 'Parks and Open Space',\n", |
61 |
| - " 'tags': 'parks, open data, tutorials',\n", |
62 |
| - " 'type': 'Shapefile'\n", |
63 |
| - "}" |
| 38 | + "from arcgis.gis import GIS\n", |
| 39 | + "import os" |
64 | 40 | ]
|
65 | 41 | },
|
66 | 42 | {
|
67 | 43 | "cell_type": "markdown",
|
68 | 44 | "metadata": {},
|
69 | 45 | "source": [
|
70 |
| - "### Download Data" |
| 46 | + "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)." |
71 | 47 | ]
|
72 | 48 | },
|
73 | 49 | {
|
74 | 50 | "cell_type": "code",
|
75 |
| - "execution_count": 37, |
| 51 | + "execution_count": 18, |
76 | 52 | "metadata": {},
|
77 | 53 | "outputs": [],
|
78 | 54 | "source": [
|
79 |
| - "# config from the Download Data Tutorial\n", |
80 |
| - "from pathlib import Path\n", |
81 |
| - "\n", |
82 |
| - "data_path = Path('./data')\n", |
83 |
| - "\n", |
84 |
| - "if not data_path.exists():\n", |
85 |
| - " data_path.mkdir()\n", |
86 |
| - "\n", |
87 |
| - "zip_path = data_path.joinpath('LA_Hub_Datasets.zip')\n", |
88 |
| - "extract_path = data_path.joinpath('LA_Hub_datasets')" |
| 55 | + "gis = GIS(profile='your_online_profile')" |
89 | 56 | ]
|
90 | 57 | },
|
91 | 58 | {
|
92 |
| - "cell_type": "markdown", |
| 59 | + "cell_type": "code", |
| 60 | + "execution_count": 10, |
93 | 61 | "metadata": {},
|
| 62 | + "outputs": [], |
94 | 63 | "source": [
|
95 |
| - "### Import Data" |
| 64 | + "parks_properties = {'title': 'Parks and Open Space',\n", |
| 65 | + " 'tags': 'parks, open data, devlabs',\n", |
| 66 | + " 'type': 'Shapefile'}\n", |
| 67 | + "data_path = os.path.join('.', 'data', 'LA_Hub_datasets', 'Parks_and_Open_Space.zip')" |
96 | 68 | ]
|
97 | 69 | },
|
98 | 70 | {
|
99 | 71 | "cell_type": "code",
|
100 |
| - "execution_count": 30, |
| 72 | + "execution_count": 19, |
101 | 73 | "metadata": {},
|
102 | 74 | "outputs": [],
|
103 | 75 | "source": [
|
104 |
| - "parks_shp_path = extract_path.joinpath('Parks_and_Open_Space.zip')\n", |
105 |
| - "parks_shp = gis.content.add(parks_properties, data=str(parks_shp_path))" |
| 76 | + "parks_shp = gis.content.add(parks_properties, data=data_path)" |
106 | 77 | ]
|
107 | 78 | },
|
108 | 79 | {
|
109 | 80 | "cell_type": "code",
|
110 |
| - "execution_count": 31, |
| 81 | + "execution_count": 20, |
111 | 82 | "metadata": {},
|
112 | 83 | "outputs": [
|
113 | 84 | {
|
114 | 85 | "data": {
|
115 | 86 | "text/html": [
|
116 | 87 | "<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",
|
117 | 88 | " <div class=\"item_left\" style=\"width: 210px; float: left;\">\n",
|
118 |
| - " <a href='https://cff-dev.maps.arcgis.com/home/item.html?id=e1667ca0ce4f4036af5c22708c595be7' target='_blank'>\n", |
| 89 | + " <a href='https://geosaurus.maps.arcgis.com/home/item.html?id=7e7d17040fdf4b35b2e5e5fef7eed7cf' target='_blank'>\n", |
119 | 90 | " <img src='http://static.arcgis.com/images/desktopapp.png' class=\"itemThumbnail\">\n",
|
120 | 91 | " </a>\n",
|
121 | 92 | " </div>\n",
|
122 | 93 | "\n",
|
123 | 94 | " <div class=\"item_right\" style=\"float: none; width: auto; overflow: hidden;\">\n",
|
124 |
| - " <a href='https://cff-dev.maps.arcgis.com/home/item.html?id=e1667ca0ce4f4036af5c22708c595be7' target='_blank'><b>Parks and Open Space</b>\n", |
| 95 | + " <a href='https://geosaurus.maps.arcgis.com/home/item.html?id=7e7d17040fdf4b35b2e5e5fef7eed7cf' target='_blank'><b>Parks and Open Space</b>\n", |
125 | 96 | " </a>\n",
|
126 |
| - " <br/><img src='https://cff-dev.maps.arcgis.com/home/js/jsapi/esri/css/images/item_type_icons/datafiles16.png' style=\"vertical-align:middle;\">Shapefile by cff_dev\n", |
127 |
| - " <br/>Last Modified: March 11, 2019\n", |
| 97 | + " <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", |
| 98 | + " <br/>Last Modified: April 11, 2019\n", |
128 | 99 | " <br/>0 comments, 0 views\n",
|
129 | 100 | " </div>\n",
|
130 | 101 | " </div>\n",
|
131 | 102 | " "
|
132 | 103 | ],
|
133 | 104 | "text/plain": [
|
134 |
| - "<Item title:\"Parks and Open Space\" type:Shapefile owner:cff_dev>" |
| 105 | + "<Item title:\"Parks and Open Space\" type:Shapefile owner:arcgis_python>" |
135 | 106 | ]
|
136 | 107 | },
|
137 |
| - "execution_count": 31, |
| 108 | + "execution_count": 20, |
138 | 109 | "metadata": {},
|
139 | 110 | "output_type": "execute_result"
|
140 | 111 | }
|
|
145 | 116 | },
|
146 | 117 | {
|
147 | 118 | "cell_type": "code",
|
148 |
| - "execution_count": 32, |
| 119 | + "execution_count": 21, |
149 | 120 | "metadata": {},
|
150 | 121 | "outputs": [],
|
151 | 122 | "source": [
|
|
154 | 125 | },
|
155 | 126 | {
|
156 | 127 | "cell_type": "code",
|
157 |
| - "execution_count": 33, |
| 128 | + "execution_count": 22, |
158 | 129 | "metadata": {},
|
159 | 130 | "outputs": [
|
160 | 131 | {
|
161 | 132 | "data": {
|
162 | 133 | "text/plain": [
|
163 |
| - "'https://services9.arcgis.com/ZPYuLYCJmpcXcod0/arcgis/rest/services/Parks_and_Open_Space/FeatureServer'" |
| 134 | + "'https://services7.arcgis.com/JEwYeAy2cc8qOe3o/arcgis/rest/services/Parks_and_Open_Space/FeatureServer'" |
164 | 135 | ]
|
165 | 136 | },
|
166 |
| - "execution_count": 33, |
| 137 | + "execution_count": 22, |
167 | 138 | "metadata": {},
|
168 | 139 | "output_type": "execute_result"
|
169 | 140 | }
|
|
0 commit comments