Skip to content

Commit be11d4c

Browse files
committed
added markdown cells to explain create_data code cells
1 parent d3dfc71 commit be11d4c

2 files changed

Lines changed: 35 additions & 79 deletions

File tree

Lines changed: 34 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,11 @@
22
"cells": [
33
{
44
"cell_type": "code",
5-
"execution_count": 1,
6-
"metadata": {},
7-
"outputs": [
8-
{
9-
"name": "stdout",
10-
"output_type": "stream",
11-
"text": [
12-
"Please enter password: ········\n",
13-
"Successfully logged in to browns.maps.arcgis.com as johnnyDev\n"
14-
]
15-
}
16-
],
5+
"execution_count": null,
6+
"metadata": {
7+
"collapsed": false
8+
},
9+
"outputs": [],
1710
"source": [
1811
"import getpass\n",
1912
"from arcgis.gis import GIS\n",
@@ -27,48 +20,23 @@
2720
},
2821
{
2922
"cell_type": "code",
30-
"execution_count": 25,
31-
"metadata": {},
32-
"outputs": [
33-
{
34-
"data": {
35-
"application/vnd.jupyter.widget-view+json": {
36-
"model_id": "8682d282eada4f26b06fed0dd34563c5"
37-
}
38-
},
39-
"metadata": {},
40-
"output_type": "display_data"
41-
},
42-
{
43-
"name": "stdout",
44-
"output_type": "stream",
45-
"text": [
46-
"<class 'list'>\n"
47-
]
48-
}
49-
],
23+
"execution_count": null,
24+
"metadata": {
25+
"collapsed": false
26+
},
27+
"outputs": [],
5028
"source": [
5129
"map1 = gis.map('Los Angeles', 10)\n",
5230
"map1"
5331
]
5432
},
5533
{
5634
"cell_type": "code",
57-
"execution_count": 8,
58-
"metadata": {},
59-
"outputs": [
60-
{
61-
"data": {
62-
"text/plain": [
63-
"[<Item title:\"Griffith Park for Notebook\" type:Feature Layer Collection owner:johnnyDev>,\n",
64-
" <Item title:\"Griffith Park CLTool\" type:Feature Layer Collection owner:johnnyDev>]"
65-
]
66-
},
67-
"execution_count": 8,
68-
"metadata": {},
69-
"output_type": "execute_result"
70-
}
71-
],
35+
"execution_count": null,
36+
"metadata": {
37+
"collapsed": false
38+
},
39+
"outputs": [],
7240
"source": [
7341
"# retrieve feature layer to add attributes to\n",
7442
"# search for feature layers\n",
@@ -80,20 +48,11 @@
8048
},
8149
{
8250
"cell_type": "code",
83-
"execution_count": 9,
84-
"metadata": {},
85-
"outputs": [
86-
{
87-
"data": {
88-
"text/plain": [
89-
"'griffith_park_for_notebook'"
90-
]
91-
},
92-
"execution_count": 9,
93-
"metadata": {},
94-
"output_type": "execute_result"
95-
}
96-
],
51+
"execution_count": null,
52+
"metadata": {
53+
"collapsed": false
54+
},
55+
"outputs": [],
9756
"source": [
9857
"# retrieve the fl collection item, then the list of \n",
9958
"# layers from the layers property, and the layer you want\n",
@@ -105,48 +64,45 @@
10564
},
10665
{
10766
"cell_type": "code",
108-
"execution_count": 26,
67+
"execution_count": null,
10968
"metadata": {
11069
"collapsed": true
11170
},
11271
"outputs": [],
11372
"source": [
114-
"from arcgis import geocoding\n",
73+
"#from arcgis import geocoding\n",
11574
"from arcgis import geometry\n",
11675
"from arcgis import features\n",
11776
"\n",
118-
"def find_addr(map1, g):\n",
77+
"def create_feature(map1, g):\n",
11978
" try:\n",
79+
" oid = 1\n",
12080
" #geocoded = geocoding.reverse_geocode(g)\n",
12181
" #print(geocoded['address']['Match_addr'])\n",
12282
" pt = geometry.Point(g)\n",
123-
" feat = features.Feature(geometry=pt)\n",
124-
" flayer.edit[feat]\n",
125-
" map1.draw(pt)\n",
83+
" feat = features.Feature(geometry=pt, attributes={'OBJECTID': oid})\n",
84+
" flayer.edit_features(adds=[feat])\n",
85+
" print(str(g))\n",
86+
" map1.draw(g)\n",
87+
" oid += 1\n",
12688
" except:\n",
127-
" print(\"Couldn't match address. Try another place...\")\n",
128-
"\n",
129-
"def pop_layer(map1, g):\n",
130-
" feat_list = []\n",
131-
" pt = geometry.Point(g)\n",
132-
" feat_list.append(features.Feature(geometry=pt))\n",
133-
" return feat_list"
89+
" print(\"Couldn't match address. Try another place...\")"
13490
]
13591
},
13692
{
13793
"cell_type": "code",
138-
"execution_count": 27,
94+
"execution_count": null,
13995
"metadata": {
14096
"collapsed": true
14197
},
14298
"outputs": [],
14399
"source": [
144-
"map1.on_click(find_addr)"
100+
"map1.on_click(create_feature)"
145101
]
146102
},
147103
{
148104
"cell_type": "code",
149-
"execution_count": 20,
105+
"execution_count": null,
150106
"metadata": {
151107
"collapsed": true
152108
},
@@ -184,7 +140,7 @@
184140
"name": "python",
185141
"nbconvert_exporter": "python",
186142
"pygments_lexer": "ipython3",
187-
"version": "3.5.3"
143+
"version": "3.5.2"
188144
}
189145
},
190146
"nbformat": 4,

labs/create_data_from_pd.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@
340340
"metadata": {
341341
"anaconda-cloud": {},
342342
"kernelspec": {
343-
"display_name": "Python 3",
343+
"display_name": "Python [default]",
344344
"language": "python",
345345
"name": "python3"
346346
},

0 commit comments

Comments
 (0)