Skip to content

Commit

Permalink
update ogc service
Browse files Browse the repository at this point in the history
  • Loading branch information
nanaeaubry committed Oct 23, 2024
1 parent 366b1ec commit 98d2867
Showing 1 changed file with 16 additions and 74 deletions.
90 changes: 16 additions & 74 deletions samples/05_content_publishers/publish_ogc_services.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -32,65 +32,12 @@
"outputs": [],
"source": [
"from arcgis.gis import GIS\n",
"from arcgis.mapping.ogc import WMTSLayer, WMSLayer, OGCFeatureService\n",
"from arcgis.mapping.layers import WMTSLayer, WMSLayer\n",
"from arcgis.mapping import WebMap\n",
"\n",
"gis = GIS(\"home\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"We can take a look at how many service types are supported by the `ogc` module in the Python API."
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['CSVLayer',\n",
" 'GeoJSONLayer',\n",
" 'GeoRSSLayer',\n",
" 'KMLLayer',\n",
" 'OGCCollection',\n",
" 'OGCFeatureService',\n",
" 'WMSLayer',\n",
" 'WMTSLayer',\n",
" '__all__',\n",
" '__builtins__',\n",
" '__cached__',\n",
" '__doc__',\n",
" '__file__',\n",
" '__loader__',\n",
" '__name__',\n",
" '__package__',\n",
" '__path__',\n",
" '__spec__',\n",
" '_base',\n",
" '_csv',\n",
" '_geojson',\n",
" '_georss',\n",
" '_kml',\n",
" '_service',\n",
" '_wms',\n",
" 'wmts']"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from arcgis.mapping import ogc\n",
"dir(ogc)"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down Expand Up @@ -245,7 +192,7 @@
],
"source": [
"m = gis.map()\n",
"m.add_layer(WMTSLayer(url=wmts_url))\n",
"m.content.add(wmts_lyr)\n",
"m"
]
},
Expand Down Expand Up @@ -509,7 +456,7 @@
}
],
"source": [
"webmap_item.delete()"
"webmap_item.delete(permanent=True)"
]
},
{
Expand All @@ -528,7 +475,7 @@
"outputs": [],
"source": [
"import json\n",
"\n",
"root_folder = gis.content.folders.get()\n",
"dictItemData = {\n",
" 'title': 'World Imagery (Wayback)', \n",
" 'tags': ['imagery', 'wayback', 'esri_imagery', 'community basemap', 'world', 'community', 'satellite', 'orthophotos', 'baseimagery', 'general availability', 'esri_basemap', 'aerial'], \n",
Expand All @@ -540,14 +487,7 @@
" 'type': 'WMTS', \n",
" 'typeKeywords': ['Data', 'OGC', 'Service', 'Web Map Tile Service']\n",
" }\n",
"item = gis.content.add(item_properties=dictItemData, upload_size=2836)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"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)."
"item = root_folder.add(item_properties=dictItemData)"
]
},
{
Expand Down Expand Up @@ -724,7 +664,7 @@
}
],
"source": [
"item.delete()"
"item.delete(permanent=True)"
]
},
{
Expand Down Expand Up @@ -883,7 +823,7 @@
],
"source": [
"m1 = gis.map()\n",
"m1.add_layer(wms_lyr)\n",
"m1.content.add(wms_lyr)\n",
"m1"
]
},
Expand Down Expand Up @@ -923,7 +863,7 @@
" 'type': 'WMS', \n",
" 'typeKeywords': ['Data', 'OGC', 'Service', 'Web Map Service']\n",
" }\n",
"wms_item = gis.content.add(item_properties=dictItemData)\n",
"wms_item = root_folder.add(item_properties=dictItemData)\n",
"wms_item.type"
]
},
Expand Down Expand Up @@ -993,7 +933,7 @@
}
],
"source": [
"wms_item.delete()"
"wms_item.delete(permanent=True)"
]
},
{
Expand Down Expand Up @@ -1188,7 +1128,9 @@
" 'type': 'WFS', \n",
" 'typeKeywords': ['Data', 'OGC', 'Service', 'Web Feature Service']\n",
" }\n",
"wfs_item = gis.content.add(item_properties=dictItemData)\n",
"\n",
"root_folder = gis.content.folders.get()\n",
"wfs_item = root_folder.add(item_properties=dictItemData)\n",
"wfs_item.type "
]
},
Expand Down Expand Up @@ -1229,7 +1171,7 @@
}
],
"source": [
"wfs_item.delete()"
"wfs_item.delete(permanent=True)"
]
},
{
Expand Down Expand Up @@ -1272,7 +1214,7 @@
"metadata": {},
"outputs": [],
"source": [
"wfs_item = gis.content.add(\n",
"wfs_item = root_folder.add(\n",
" item_properties={\n",
" \"title\": \"Sample WFS Map\",\n",
" \"type\": \"Web Map\",\n",
Expand All @@ -1295,7 +1237,7 @@
"metadata": {},
"outputs": [],
"source": [
"wm_obj2 = WebMap(wfs_item)\n",
"wm_obj2 = Map(item=wfs_item)\n",
"printed_file_url = wm_obj2.print(file_format='JPG', \n",
" extent={\"xmin\":-10909090.288200358,\"ymin\":2331023.6145840986,\"xmax\":-6203015.330739876,\"ymax\":6401142.496712082,\"spatialReference\":{\"wkid\":102100,\"latestWkid\":3857}})"
]
Expand Down Expand Up @@ -1341,7 +1283,7 @@
}
],
"source": [
"wfs_item.delete()"
"wfs_item.delete(permanent=True)"
]
},
{
Expand Down

0 comments on commit 98d2867

Please sign in to comment.