Open nickrsan opened 2 weeks ago
Holding a code snippet here that we'll need to expand on later:
server_info = urllib.parse.urlparse(self.dataset)
netloc = "arcgis.com" if "arcgis.com" in server_info.netloc else server_info.netloc # if we have subdomain of arcgis.com, just connect to the root URL. Otherwise, use the full domain
server_address = f"{server_info.scheme}://{netloc}"
self._arcgis_connection = arcgis.gis.GIS(server_address)
self._arcgis_connection_item = self._arcgis_connection.content.get(server_info.path)
arcpy will pull metadata down from at least a subset of ArcGIS server services, and then the arcgis API for Python can export it from services that have portal in front of them, but we need the item ID. So, a rough workflow:
-[ ] Detect that we have a server-based dataset and parse the URL -[ ] Parse the URL - if it already has the item ID in it, extract it -[ ] If it doesn't, then load the page as an ArcGIS Server page and see if it has the item ID in the text - items from portal will. Parse it out -[ ] Load the item in ArcGIS API for Python, export the metadata -[ ] Servers without portal won't have an itemID there, so we'll fall back to arcpy (below).
Proceed as normal.