Skip to content

Commit 98d2867

Browse files
committed
update ogc service
1 parent 366b1ec commit 98d2867

File tree

1 file changed

+16
-74
lines changed

1 file changed

+16
-74
lines changed

samples/05_content_publishers/publish_ogc_services.ipynb

Lines changed: 16 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -32,65 +32,12 @@
3232
"outputs": [],
3333
"source": [
3434
"from arcgis.gis import GIS\n",
35-
"from arcgis.mapping.ogc import WMTSLayer, WMSLayer, OGCFeatureService\n",
35+
"from arcgis.mapping.layers import WMTSLayer, WMSLayer\n",
3636
"from arcgis.mapping import WebMap\n",
3737
"\n",
3838
"gis = GIS(\"home\")"
3939
]
4040
},
41-
{
42-
"cell_type": "markdown",
43-
"metadata": {},
44-
"source": [
45-
"We can take a look at how many service types are supported by the `ogc` module in the Python API."
46-
]
47-
},
48-
{
49-
"cell_type": "code",
50-
"execution_count": 2,
51-
"metadata": {},
52-
"outputs": [
53-
{
54-
"data": {
55-
"text/plain": [
56-
"['CSVLayer',\n",
57-
" 'GeoJSONLayer',\n",
58-
" 'GeoRSSLayer',\n",
59-
" 'KMLLayer',\n",
60-
" 'OGCCollection',\n",
61-
" 'OGCFeatureService',\n",
62-
" 'WMSLayer',\n",
63-
" 'WMTSLayer',\n",
64-
" '__all__',\n",
65-
" '__builtins__',\n",
66-
" '__cached__',\n",
67-
" '__doc__',\n",
68-
" '__file__',\n",
69-
" '__loader__',\n",
70-
" '__name__',\n",
71-
" '__package__',\n",
72-
" '__path__',\n",
73-
" '__spec__',\n",
74-
" '_base',\n",
75-
" '_csv',\n",
76-
" '_geojson',\n",
77-
" '_georss',\n",
78-
" '_kml',\n",
79-
" '_service',\n",
80-
" '_wms',\n",
81-
" 'wmts']"
82-
]
83-
},
84-
"execution_count": 2,
85-
"metadata": {},
86-
"output_type": "execute_result"
87-
}
88-
],
89-
"source": [
90-
"from arcgis.mapping import ogc\n",
91-
"dir(ogc)"
92-
]
93-
},
9441
{
9542
"cell_type": "markdown",
9643
"metadata": {},
@@ -245,7 +192,7 @@
245192
],
246193
"source": [
247194
"m = gis.map()\n",
248-
"m.add_layer(WMTSLayer(url=wmts_url))\n",
195+
"m.content.add(wmts_lyr)\n",
249196
"m"
250197
]
251198
},
@@ -509,7 +456,7 @@
509456
}
510457
],
511458
"source": [
512-
"webmap_item.delete()"
459+
"webmap_item.delete(permanent=True)"
513460
]
514461
},
515462
{
@@ -528,7 +475,7 @@
528475
"outputs": [],
529476
"source": [
530477
"import json\n",
531-
"\n",
478+
"root_folder = gis.content.folders.get()\n",
532479
"dictItemData = {\n",
533480
" 'title': 'World Imagery (Wayback)', \n",
534481
" 'tags': ['imagery', 'wayback', 'esri_imagery', 'community basemap', 'world', 'community', 'satellite', 'orthophotos', 'baseimagery', 'general availability', 'esri_basemap', 'aerial'], \n",
@@ -540,14 +487,7 @@
540487
" 'type': 'WMTS', \n",
541488
" 'typeKeywords': ['Data', 'OGC', 'Service', 'Web Map Tile Service']\n",
542489
" }\n",
543-
"item = gis.content.add(item_properties=dictItemData, upload_size=2836)"
544-
]
545-
},
546-
{
547-
"cell_type": "markdown",
548-
"metadata": {},
549-
"source": [
550-
"Here, the `upload_size` is an optional parameter, specifying the minimum default value for the size of the file when uploading by parts (float. The default value is 1e7 bytes or ~10 MBs). For more info, please check [add](https://developers.arcgis.com/python/api-reference/arcgis.gis.toc.html#arcgis.gis.ContentManager.add)."
490+
"item = root_folder.add(item_properties=dictItemData)"
551491
]
552492
},
553493
{
@@ -724,7 +664,7 @@
724664
}
725665
],
726666
"source": [
727-
"item.delete()"
667+
"item.delete(permanent=True)"
728668
]
729669
},
730670
{
@@ -883,7 +823,7 @@
883823
],
884824
"source": [
885825
"m1 = gis.map()\n",
886-
"m1.add_layer(wms_lyr)\n",
826+
"m1.content.add(wms_lyr)\n",
887827
"m1"
888828
]
889829
},
@@ -923,7 +863,7 @@
923863
" 'type': 'WMS', \n",
924864
" 'typeKeywords': ['Data', 'OGC', 'Service', 'Web Map Service']\n",
925865
" }\n",
926-
"wms_item = gis.content.add(item_properties=dictItemData)\n",
866+
"wms_item = root_folder.add(item_properties=dictItemData)\n",
927867
"wms_item.type"
928868
]
929869
},
@@ -993,7 +933,7 @@
993933
}
994934
],
995935
"source": [
996-
"wms_item.delete()"
936+
"wms_item.delete(permanent=True)"
997937
]
998938
},
999939
{
@@ -1188,7 +1128,9 @@
11881128
" 'type': 'WFS', \n",
11891129
" 'typeKeywords': ['Data', 'OGC', 'Service', 'Web Feature Service']\n",
11901130
" }\n",
1191-
"wfs_item = gis.content.add(item_properties=dictItemData)\n",
1131+
"\n",
1132+
"root_folder = gis.content.folders.get()\n",
1133+
"wfs_item = root_folder.add(item_properties=dictItemData)\n",
11921134
"wfs_item.type "
11931135
]
11941136
},
@@ -1229,7 +1171,7 @@
12291171
}
12301172
],
12311173
"source": [
1232-
"wfs_item.delete()"
1174+
"wfs_item.delete(permanent=True)"
12331175
]
12341176
},
12351177
{
@@ -1272,7 +1214,7 @@
12721214
"metadata": {},
12731215
"outputs": [],
12741216
"source": [
1275-
"wfs_item = gis.content.add(\n",
1217+
"wfs_item = root_folder.add(\n",
12761218
" item_properties={\n",
12771219
" \"title\": \"Sample WFS Map\",\n",
12781220
" \"type\": \"Web Map\",\n",
@@ -1295,7 +1237,7 @@
12951237
"metadata": {},
12961238
"outputs": [],
12971239
"source": [
1298-
"wm_obj2 = WebMap(wfs_item)\n",
1240+
"wm_obj2 = Map(item=wfs_item)\n",
12991241
"printed_file_url = wm_obj2.print(file_format='JPG', \n",
13001242
" extent={\"xmin\":-10909090.288200358,\"ymin\":2331023.6145840986,\"xmax\":-6203015.330739876,\"ymax\":6401142.496712082,\"spatialReference\":{\"wkid\":102100,\"latestWkid\":3857}})"
13011243
]
@@ -1341,7 +1283,7 @@
13411283
}
13421284
],
13431285
"source": [
1344-
"wfs_item.delete()"
1286+
"wfs_item.delete(permanent=True)"
13451287
]
13461288
},
13471289
{

0 commit comments

Comments
 (0)