Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -883,7 +883,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.8"
"version": "3.11.10"
}
},
"nbformat": 4,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<ImportMXDLog>No error, no warning</ImportMXDLog>
234 changes: 207 additions & 27 deletions Exercises/Chapter 04 - ArcGIS Python API Basics/Chapter 3.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": null,
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -15,37 +15,81 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 5,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/html": [
"<div class=\"9item_container\" style=\"height: auto; overflow: hidden; border: 1px solid #cfcfcf; border-radius: 2px; background: #f6fafa; line-height: 1.21429em; padding: 10px;\">\n",
" <div class=\"item_left\" style=\"width: 210px; float: left;\">\n",
" <a href='https://www.arcgis.com//home/user.html?user=dave_crawford@esri.com_prof_services' target='_blank'>\n",
" <img src='https://www.arcgis.com//home/js/arcgisonline/css/images/no-user-thumb.jpg' class=\"itemThumbnail\">\n",
" </a>\n",
" </div>\n",
"\n",
" <div class=\"item_right\" style=\"float: none; width: auto; overflow: hidden;\">\n",
" <a href='https://www.arcgis.com//home/user.html?user=dave_crawford@esri.com_prof_services' target='_blank'><b>Dave Crawford</b>\n",
" </a>\n",
" <br/><br/><b>Bio</b>: None\n",
" <br/><b>First Name</b>: Dave\n",
" <br/><b>Last Name</b>: Crawford\n",
" <br/><b>Username</b>: dave_crawford@esri.com_prof_services\n",
" <br/><b>Joined</b>: July 31, 2024\n",
"\n",
" </div>\n",
" </div>\n",
" "
],
"text/plain": [
"<User username:dave_crawford@esri.com_prof_services>"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"my_gis_org = GIS(\n",
" url = \"https://www.arcgis.com\" , # or your Portal URL\n",
" profile=\"my_profile\",\n",
" )\n"
"my_gis_org = GIS(\"home\")\n",
"my_gis_org.users.me\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
"source_fgdb_path = Path(r\"C:\\Users\\gis_pro\\Documents\\ArcGIS\\Projects\\MyProject\\MyProject.gdb\")"
"source_fgdb_path = Path(r\".\\Parking_Violations_and_Neighborhoods.gdb\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 7,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/html": [
"<div class='gpresult'><h2 class='msg-title'>Messages</h2><div id='messages'>Start Time: Tuesday, December 31, 2024 2:34:57 PM<br>Succeeded at Tuesday, December 31, 2024 2:34:57 PM (Elapsed Time: 0.40 seconds)<br></div><div id = 'default' /></div></div>"
],
"text/plain": [
"<Result 'Parking_Violations_and_Neighborhoods.gdb'>"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"arcpy.management.Compact(str(source_fgdb_path))"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 8,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -61,7 +105,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 10,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -77,7 +121,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 11,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -91,9 +135,18 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 12,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"c:\\Users\\dav11274\\AppData\\Local\\ESRI\\conda\\envs\\quacker34\\Lib\\site-packages\\IPython\\core\\interactiveshell.py:3550: DeprecatedWarning: add is deprecated as of 2.3.0 and has been removed in 3.0.0. Use `Folder.add()` instead.\n",
" exec(code_obj, self.user_global_ns, self.user_ns)\n"
]
}
],
"source": [
"my_fgdb_item = my_gis_org.content.add(\n",
" item_properties=fgdb_item_properties, # The properties of the item\n",
Expand All @@ -103,16 +156,45 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 13,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/html": [
"<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",
" <div class=\"item_left\" style=\"width: 210px; float: left;\">\n",
" <a href='https://www.arcgis.com//home/item.html?id=7abfdf435901405488d5280dc2d0f079' target='_blank'>\n",
" <img src='http://static.arcgis.com/images/desktopapp.png' class=\"itemThumbnail\">\n",
" </a>\n",
" </div>\n",
"\n",
" <div class=\"item_right\" style=\"float: none; width: auto; overflow: hidden;\">\n",
" <a href='https://www.arcgis.com//home/item.html?id=7abfdf435901405488d5280dc2d0f079' target='_blank'><b>Philadelphia Parking Tickets by Neighborhood</b>\n",
" </a>\n",
" <br/><br/><img src='https://www.arcgis.com//home/js/jsapi/esri/css/images/item_type_icons/layers16.png' style=\"vertical-align:middle;\" width=16 height=16>File Geodatabase by dave_crawford@esri.com_prof_services\n",
" <br/>Last Modified: December 31, 2024\n",
" <br/>0 comments, 0 views\n",
" </div>\n",
" </div>\n",
" "
],
"text/plain": [
"<Item title:\"Philadelphia Parking Tickets by Neighborhood\" type:File Geodatabase owner:dave_crawford@esri.com_prof_services>"
]
},
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"my_fgdb_item = my_gis_org.content.get(\"cb0765ce42bc41dfb9e0bc62ae3ce4c0\")"
"my_fgdb_item"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 14,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -123,7 +205,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 15,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -134,16 +216,65 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 16,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/html": [
"<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",
" <div class=\"item_left\" style=\"width: 210px; float: left;\">\n",
" <a href='https://www.arcgis.com//home/item.html?id=35d86dffe26d494f813317a9bca75cf8' target='_blank'>\n",
" <img src='http://static.arcgis.com/images/desktopapp.png' class=\"itemThumbnail\">\n",
" </a>\n",
" </div>\n",
"\n",
" <div class=\"item_right\" style=\"float: none; width: auto; overflow: hidden;\">\n",
" <a href='https://www.arcgis.com//home/item.html?id=35d86dffe26d494f813317a9bca75cf8' target='_blank'><b>Philadelphia Parking Tickets by Neighborhood</b>\n",
" </a>\n",
" <br/><br/><img src='https://www.arcgis.com//home/js/jsapi/esri/css/images/item_type_icons/featureshosted16.png' style=\"vertical-align:middle;\" width=16 height=16>Feature Layer Collection by dave_crawford@esri.com_prof_services\n",
" <br/>Last Modified: December 31, 2024\n",
" <br/>0 comments, 0 views\n",
" </div>\n",
" </div>\n",
" "
],
"text/plain": [
"<Item title:\"Philadelphia Parking Tickets by Neighborhood\" type:Feature Layer Collection owner:dave_crawford@esri.com_prof_services>"
]
},
"execution_count": 16,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"my_hosted_feature_service_item"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['Philadelphia_Neighborhoods', 'Parking_Violations_Dec_2017']"
]
},
"execution_count": 17,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"[layer.properties[\"name\"] for layer in my_hosted_feature_service_item.layers]"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 18,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -152,9 +283,19 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 19,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"c:\\Users\\dav11274\\AppData\\Local\\ESRI\\conda\\envs\\quacker34\\Lib\\site-packages\\urllib3\\connectionpool.py:1099: InsecureRequestWarning: Unverified HTTPS request is being made to host 'analysis1.arcgis.com'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#tls-warnings\n",
" warnings.warn(\n",
"{\"cost\": -1}\n"
]
}
],
"source": [
"enriched_layer = analysis.enrich_layer(\n",
" input_layer=parking_tickets_by_neighborhood_layer, # FeatureLayer object to be enriched\n",
Expand All @@ -164,11 +305,50 @@
" output_name=\"Philadelphia Parking Tickets by Neighborhood Enriched with Property Crime\", # The name of the output layer\n",
")"
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'99e38076e5dc4be3889b237edaff9c4a'"
]
},
"execution_count": 16,
"metadata": {},
"output_type": "execute_result"
}
],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"name": "python"
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.10"
}
},
"nbformat": 4,
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading