|
32 | 32 | "outputs": [], |
33 | 33 | "source": [ |
34 | 34 | "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", |
36 | 36 | "from arcgis.mapping import WebMap\n", |
37 | 37 | "\n", |
38 | 38 | "gis = GIS(\"home\")" |
39 | 39 | ] |
40 | 40 | }, |
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 | | - }, |
94 | 41 | { |
95 | 42 | "cell_type": "markdown", |
96 | 43 | "metadata": {}, |
|
245 | 192 | ], |
246 | 193 | "source": [ |
247 | 194 | "m = gis.map()\n", |
248 | | - "m.add_layer(WMTSLayer(url=wmts_url))\n", |
| 195 | + "m.content.add(wmts_lyr)\n", |
249 | 196 | "m" |
250 | 197 | ] |
251 | 198 | }, |
|
509 | 456 | } |
510 | 457 | ], |
511 | 458 | "source": [ |
512 | | - "webmap_item.delete()" |
| 459 | + "webmap_item.delete(permanent=True)" |
513 | 460 | ] |
514 | 461 | }, |
515 | 462 | { |
|
528 | 475 | "outputs": [], |
529 | 476 | "source": [ |
530 | 477 | "import json\n", |
531 | | - "\n", |
| 478 | + "root_folder = gis.content.folders.get()\n", |
532 | 479 | "dictItemData = {\n", |
533 | 480 | " 'title': 'World Imagery (Wayback)', \n", |
534 | 481 | " 'tags': ['imagery', 'wayback', 'esri_imagery', 'community basemap', 'world', 'community', 'satellite', 'orthophotos', 'baseimagery', 'general availability', 'esri_basemap', 'aerial'], \n", |
|
540 | 487 | " 'type': 'WMTS', \n", |
541 | 488 | " 'typeKeywords': ['Data', 'OGC', 'Service', 'Web Map Tile Service']\n", |
542 | 489 | " }\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)" |
551 | 491 | ] |
552 | 492 | }, |
553 | 493 | { |
|
724 | 664 | } |
725 | 665 | ], |
726 | 666 | "source": [ |
727 | | - "item.delete()" |
| 667 | + "item.delete(permanent=True)" |
728 | 668 | ] |
729 | 669 | }, |
730 | 670 | { |
|
883 | 823 | ], |
884 | 824 | "source": [ |
885 | 825 | "m1 = gis.map()\n", |
886 | | - "m1.add_layer(wms_lyr)\n", |
| 826 | + "m1.content.add(wms_lyr)\n", |
887 | 827 | "m1" |
888 | 828 | ] |
889 | 829 | }, |
|
923 | 863 | " 'type': 'WMS', \n", |
924 | 864 | " 'typeKeywords': ['Data', 'OGC', 'Service', 'Web Map Service']\n", |
925 | 865 | " }\n", |
926 | | - "wms_item = gis.content.add(item_properties=dictItemData)\n", |
| 866 | + "wms_item = root_folder.add(item_properties=dictItemData)\n", |
927 | 867 | "wms_item.type" |
928 | 868 | ] |
929 | 869 | }, |
|
993 | 933 | } |
994 | 934 | ], |
995 | 935 | "source": [ |
996 | | - "wms_item.delete()" |
| 936 | + "wms_item.delete(permanent=True)" |
997 | 937 | ] |
998 | 938 | }, |
999 | 939 | { |
|
1188 | 1128 | " 'type': 'WFS', \n", |
1189 | 1129 | " 'typeKeywords': ['Data', 'OGC', 'Service', 'Web Feature Service']\n", |
1190 | 1130 | " }\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", |
1192 | 1134 | "wfs_item.type " |
1193 | 1135 | ] |
1194 | 1136 | }, |
|
1229 | 1171 | } |
1230 | 1172 | ], |
1231 | 1173 | "source": [ |
1232 | | - "wfs_item.delete()" |
| 1174 | + "wfs_item.delete(permanent=True)" |
1233 | 1175 | ] |
1234 | 1176 | }, |
1235 | 1177 | { |
|
1272 | 1214 | "metadata": {}, |
1273 | 1215 | "outputs": [], |
1274 | 1216 | "source": [ |
1275 | | - "wfs_item = gis.content.add(\n", |
| 1217 | + "wfs_item = root_folder.add(\n", |
1276 | 1218 | " item_properties={\n", |
1277 | 1219 | " \"title\": \"Sample WFS Map\",\n", |
1278 | 1220 | " \"type\": \"Web Map\",\n", |
|
1295 | 1237 | "metadata": {}, |
1296 | 1238 | "outputs": [], |
1297 | 1239 | "source": [ |
1298 | | - "wm_obj2 = WebMap(wfs_item)\n", |
| 1240 | + "wm_obj2 = Map(item=wfs_item)\n", |
1299 | 1241 | "printed_file_url = wm_obj2.print(file_format='JPG', \n", |
1300 | 1242 | " extent={\"xmin\":-10909090.288200358,\"ymin\":2331023.6145840986,\"xmax\":-6203015.330739876,\"ymax\":6401142.496712082,\"spatialReference\":{\"wkid\":102100,\"latestWkid\":3857}})" |
1301 | 1243 | ] |
|
1341 | 1283 | } |
1342 | 1284 | ], |
1343 | 1285 | "source": [ |
1344 | | - "wfs_item.delete()" |
| 1286 | + "wfs_item.delete(permanent=True)" |
1345 | 1287 | ] |
1346 | 1288 | }, |
1347 | 1289 | { |
|
0 commit comments