Skip to content

Commit

Permalink
Merge pull request #2065 from Esri/next
Browse files Browse the repository at this point in the history
Merge changes from next branch into master for the 2.4 release.
  • Loading branch information
jyaistMap authored Sep 24, 2024
2 parents ae7711c + 65da70a commit cd85607
Show file tree
Hide file tree
Showing 138 changed files with 68,758 additions and 33,352 deletions.
197 changes: 197 additions & 0 deletions guide/02-api-overview/deprecation-notices.ipynb

Large diffs are not rendered by default.

489 changes: 489 additions & 0 deletions guide/02-api-overview/overview24.ipynb

Large diffs are not rendered by default.

513 changes: 513 additions & 0 deletions guide/02-api-overview/release_notes_240.ipynb

Large diffs are not rendered by default.

99 changes: 40 additions & 59 deletions guide/03-the-gis/accessing-and-creating-content.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,7 @@
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"C:\\Users\\tar12555\\AppData\\Local\\ESRI\\conda\\envs\\pyapi-dev\\lib\\site-packages\\numpy\\_distributor_init.py:30: UserWarning: loaded more than 1 DLL from .libs:\n",
"C:\\Users\\tar12555\\AppData\\Local\\ESRI\\conda\\envs\\pyapi-dev\\lib\\site-packages\\numpy\\.libs\\libopenblas64__v0.3.23-246-g3d31191b-gcc_10_3_0.dll\n",
"C:\\Users\\tar12555\\AppData\\Local\\ESRI\\conda\\envs\\pyapi-dev\\lib\\site-packages\\numpy\\.libs\\libopenblas64__v0.3.23-gcc_10_3_0.dll\n",
" warnings.warn(\"loaded more than 1 DLL from .libs:\"\n",
"C:\\Users\\tar12555\\AppData\\Local\\ESRI\\conda\\envs\\pyapi-dev\\lib\\site-packages\\scipy\\__init__.py:138: UserWarning: A NumPy version >=1.16.5 and <1.23.0 is required for this version of SciPy (detected version 1.25.2)\n",
" warnings.warn(f\"A NumPy version >={np_minversion} and <{np_maxversion} is required for this version of \"\n"
]
}
],
"outputs": [],
"source": [
"import os\n",
"import datetime as dt\n",
Expand All @@ -64,9 +51,9 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"As mentioned in the [`gis module`](https://developers.arcgis.com/python/guide/the-gis-module/) guide, the Python API uses [Resource Manager classes](https://developers.arcgis.com/python/guide/the-gis-module/) to manage Web GIS users, groups, datastores, and content. You access the [`UserManager`](https://developers.arcgis.com/python/api-reference/arcgis.gis.toc.html#arcgis.gis.UserManager), [`GroupManager`](https://developers.arcgis.com/python/api-reference/arcgis.gis.toc.html#groupmanager) and [`ContentManager`](https://developers.arcgis.com/python/api-reference/arcgis.gis.toc.html#arcgis.gis.ContentManager) classes as the `users`, `groups`, and `content` properties of the [`GIS`](https://developers.arcgis.com/python/api-reference/arcgis.gis.toc.html#gis), respectively. (See [`Helper objects`](https://developers.arcgis.com/python/api-reference/arcgis.gis.toc.html#gis) for details.)\n",
"As mentioned in the [`gis module`](/python/guide/the-gis-module/) guide, the Python API uses [Resource Manager classes](/python/guide/the-gis-module/) to manage Web GIS users, groups, datastores, and content. You access the [`UserManager`](/python/api-reference/arcgis.gis.toc.html#arcgis.gis.UserManager), [`GroupManager`](/python/api-reference/arcgis.gis.toc.html#groupmanager) and [`ContentManager`](/python/api-reference/arcgis.gis.toc.html#arcgis.gis.ContentManager) classes as the `users`, `groups`, and `content` properties of the [`GIS`](/python/api-reference/arcgis.gis.toc.html#gis), respectively.\n",
"\n",
"Each resource manager implements the [ArcGIS REST API](https://developers.arcgis.com/rest/users-groups-and-items/search.htm) `search` operation as a method. For example, `gis.content.search()`. It's important to understand that the `search` mechanism uses many different inputs to find possible matches, ranks them and returns appropriate results. The `search` becomes ideal for human interaction, but `fuzzy` when looking for specific records programmatically. The search results are non-deterministic. Using `search` may not necessarily be the best approach for finding specific items, but more a group of items from which to further filter. \n",
"Each search resource manager, for example _gis.content.search()_, implements the [ArcGIS REST API](/rest/users-groups-and-items/search.htm) `search` operation. It's important to understand that the `search` mechanism uses many different inputs to find possible matches, ranks them and returns appropriate results. The `search` becomes ideal for human interaction, but `fuzzy` when looking for specific records programmatically. The search results are non-deterministic. Using `search` may not necessarily be the best approach for finding specific items, but more a group of items from which to further filter. \n",
"\n",
"It's also important to know that using `search` programmatically, like with the Python API, does not correspond identically to searching with an application written in a different language. The various `search` options in the ArcGIS Online or Portal for ArcGIS Enterprise interfaces work differently than the Python API resource managers' `search`. Different applications may use different inputs. The relationship between a content `search` in one application, like a Portal or ArcGIS Online viewer, is not one-to-one with a content search using the Python API even when logged in as the same user.\n",
"\n",
Expand All @@ -75,7 +62,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -203,12 +190,12 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 37,
"metadata": {},
"outputs": [],
"source": [
"day_start = dt.datetime(2019, 5, 30, 0, 0, 0, 0)\n",
"day_end = dt.datetime(2019, 5, 30, 23, 59, 59, 999999)\n",
"day_start = dt.datetime(2023, 9, 21, 0, 0, 0, 0)\n",
"day_end = dt.datetime(2023, 9, 21, 23, 59, 59, 999999)\n",
"\n",
"start_timestamp = int(day_start.timestamp() * 1000)\n",
"end_timestamp = int(day_end.timestamp() * 1000)"
Expand All @@ -223,16 +210,17 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 40,
"metadata": {},
"outputs": [],
"source": [
"content_published_53019 = [item\n",
" for item in gis.content.search(query=\"* AND \\\n",
" owner:\" + gis.users.me.username,\n",
" max_items=50)\n",
" if item.created > start_timestamp \n",
" and item.created < end_timestamp]"
"content_published_92123 = [\n",
" item\n",
" for item in gis.content.search(\n",
" query=f\"owner:{gis.users.me.username}\",\n",
" max_items=100) \n",
" if item.created > start_timestamp\n",
" and item.created < end_timestamp]"
]
},
{
Expand All @@ -244,7 +232,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 41,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -254,14 +242,16 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 45,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Item Title Item Type Published \n"
"Item Title Item Type Published \n",
"425e9ee3dd774bbe8d472b73e9cadbd2 File Geodatabase September 21 2023 at 10:45.47 AM \n",
"ad37530ecc3744e8b3a9db52adde6408 File Geodatabase September 21 2023 at 10:43.44 AM \n"
]
}
],
Expand All @@ -271,8 +261,8 @@
"publish = \"Published\"\n",
"print(f\"{title:40}{item_type:25}{publish:40}\")\n",
"\n",
"for content in content_published_53019:\n",
" print(f\" {content.title:<40} {content.type:25} {readable_date(content.created):40}\")"
"for content in content_published_92123:\n",
" print(f\"{content.title:<40}{content.type:25}{readable_date(content.created):40}\")"
]
},
{
Expand Down Expand Up @@ -1435,11 +1425,11 @@
"source": [
"## Creating new content\n",
"\n",
"To create new items on your GIS, you use the [`add()`](https://developers.arcgis.com/python/api-reference/arcgis.gis.toc.html#arcgis.gis.ContentManager.add) method on a `ContentManager` instance. Again, rather than creating an instance of the `ContentManager` directly, the Python API implements the class as the `content` property of your `GIS` object.\n",
"To create new items on your GIS, use the [`add()`](/api-reference/arcgis.gis.toc.html#arcgis.gis._impl._content_manager.Folder.add) method on a [`Folder`](/python/api-reference/arcgis.gis.toc.html#folder) instance. You can get an individual _folder_ using the [`Folders.get()`](/python/api-reference/arcgis.gis.toc.html#arcgis.gis._impl._content_manager.Folders.get) method.\n",
"\n",
"The `add()` method accepts a dictionary containing the properties of the item to be created. The optional `data` parameter accepts a string path to a file. You can use the optional `metadata` parameter to specify an XML file containing metadata information.\n",
"The `add()` method accepts a dictionary containing the properties of the item to be created. The optional `file`, `text`, `url`, and `data_url` parameters accept input to add the actual content. \n",
"\n",
"All content you add this way is added to the authenticated user's contents. Let us connect to our Enterprise instance, add a csv file as an item and then publish a feature layer from it.\n",
"All content you add this way is added to the authenticated user's dolswe. Let us connect to our Enterprise instance, add a csv file as an item and then publish a feature layer from it.\n",
"\n",
"For example, set up a path to the data:\n",
"`data_path = os.path.join(r\"<your_drive>:\\\\\", \"path\", \"to\", \"data\")`"
Expand Down Expand Up @@ -1492,8 +1482,12 @@
" 'tags':'arcgis, python, earthquake, natural disaster, emergency'}\n",
"thumbnail_path = os.path.join(data_path, \"earthquake.png\")\n",
"\n",
"earthquake_csv_item = gis.content.add(item_properties=csv_properties, data=csv_path,\n",
" thumbnail = thumbnail_path)"
"root_folder = gis.content.folders.get()\n",
"earthquake_csv_item = root_folder.add(\n",
" item_properties=csv_properties, \n",
" data=csv_path,\n",
" thumbnail = thumbnail_path\n",
").result()"
]
},
{
Expand Down Expand Up @@ -1617,7 +1611,10 @@
{
"cell_type": "markdown",
"metadata": {
"collapsed": true
"collapsed": true,
"jupyter": {
"outputs_hidden": true
}
},
"source": [
"<a id=\"importing-data-from-a-pandas-data-frame\"></a>\n",
Expand Down Expand Up @@ -2325,7 +2322,7 @@
" 'tags': 'arcgis python api, pandas, csv',\n",
" 'text':ports_json,\n",
" 'type':'Feature Collection'}\n",
"ports_item = gis.content.add(ports_item_properties)\n",
"ports_item = root_folder.add(ports_item_properties).result()\n",
"ports_item"
]
},
Expand Down Expand Up @@ -2466,14 +2463,6 @@
"execution_count": 38,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"C:\\Users\\tar12555\\AppData\\Local\\ESRI\\conda\\envs\\pyapi-dev\\lib\\site-packages\\IPython\\core\\interactiveshell.py:3553: DeprecatedWarning: create_folder is deprecated as of 2.3.0 and has be removed in 3.0.0. Use `gis.content.folders.create` instead.\n",
" exec(code_obj, self.user_global_ns, self.user_ns)\n"
]
},
{
"data": {
"text/plain": [
Expand All @@ -2489,7 +2478,7 @@
],
"source": [
"# create new folder\n",
"gis.content.create_folder(folder='ports')"
"gis.content.folders.create_folder(folder='ports')"
]
},
{
Expand Down Expand Up @@ -2552,14 +2541,6 @@
"execution_count": 41,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"C:\\Users\\tar12555\\AppData\\Local\\ESRI\\conda\\envs\\pyapi-dev\\lib\\site-packages\\IPython\\core\\interactiveshell.py:3553: DeprecatedWarning: delete_folder is deprecated as of 2.3.0 and has be removed in 3.0.0. Use `Folder.delete()` instead.\n",
" exec(code_obj, self.user_global_ns, self.user_ns)\n"
]
},
{
"data": {
"text/plain": [
Expand All @@ -2572,7 +2553,7 @@
}
],
"source": [
"gis.content.delete_folder(folder='ports')"
"gis.content.folders.delete_folder(folder='ports')"
]
},
{
Expand Down Expand Up @@ -2601,7 +2582,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.16"
"version": "3.11.0"
},
"toc": {
"base_numbering": 1,
Expand Down Expand Up @@ -2647,5 +2628,5 @@
}
},
"nbformat": 4,
"nbformat_minor": 1
"nbformat_minor": 4
}
19 changes: 13 additions & 6 deletions guide/03-the-gis/accessing-and-managing-groups.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,10 @@
{
"cell_type": "markdown",
"metadata": {
"collapsed": true
"collapsed": true,
"jupyter": {
"outputs_hidden": true
}
},
"source": [
"The `search()` method returns a list of objects of type `arcgis.gis.Group`. When using the Jupyter notebook environment, `Group` objects can be represented in rich HTML with their thumbnail and metadata information."
Expand Down Expand Up @@ -432,7 +435,11 @@
"item_properties = {'title':'Hidden treasures',\n",
" 'tags':['geocaching', 'searching', 'hikes', 'POI'],\n",
" 'snippet':'Points containing treasures for geocaching activity'}\n",
"fc_item = gis.content.add(item_properties, data='../../samples/05_content_publishers/data/hidden_treasures_geocaching.csv')"
"root_folder = gis.content.folders.get()\n",
"fc_item = root_folder.add(\n",
" item_properties, \n",
" data='../../samples/05_content_publishers/data/hidden_treasures_geocaching.csv'\n",
").result()"
]
},
{
Expand Down Expand Up @@ -470,7 +477,7 @@
{
"data": {
"text/plain": [
"{'notSharedWith': [], 'itemId': '538a4c39061043828f5d7a4d2a09c30b'}"
"True"
]
},
"execution_count": 162,
Expand All @@ -480,7 +487,7 @@
],
"source": [
"# let us share it to the group so other enthusiasts can enjoy this map\n",
"fc_item.share(groups=[geocaching_group])"
"fc_item.sharing.groups.add(group=geocaching_group)"
]
},
{
Expand Down Expand Up @@ -940,7 +947,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.16"
"version": "3.11.0"
},
"toc": {
"base_numbering": 1,
Expand All @@ -957,5 +964,5 @@
}
},
"nbformat": 4,
"nbformat_minor": 1
"nbformat_minor": 4
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"metadata": {},
"outputs": [],
"source": [
"map1 = gis.map(\"Tamil Nadu\", zoomlevel = 8)"
"map1 = gis.map(\"Tamil Nadu\")"
]
},
{
Expand All @@ -63,7 +63,7 @@
"metadata": {},
"outputs": [],
"source": [
"map1.add_layer(chennai_rainfall, { \"renderer\":\"ClassedSizeRenderer\", \"field_name\":\"RAINFALL\" })"
"map1.content.add(chennai_rainfall)"
]
},
{
Expand All @@ -87,6 +87,17 @@
"![image-chennai-rainfall.png](attachment:image-chennai-rainfall.png)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"renderer_manager = map1.content.renderer(0)\n",
"smart_map_manager = renderer_manager.smart_mapping()\n",
"smart_map_manager.class_breaks_renderer(break_type=\"size\", field=\"RAINFALL\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down Expand Up @@ -131,7 +142,7 @@
"metadata": {},
"outputs": [],
"source": [
"interpolated_map = gis.map(\"Tamil Nadu\", zoomlevel = 8)"
"interpolated_map = gis.map(\"Tamil Nadu\")"
]
},
{
Expand All @@ -140,7 +151,7 @@
"metadata": {},
"outputs": [],
"source": [
"interpolated_map.add_layer(interpolated_rf['result_layer'])"
"interpolated_map.content.add(interpolated_rf['result_layer'])"
]
},
{
Expand Down
Loading

0 comments on commit cd85607

Please sign in to comment.