Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Server-based dataset editing #62

Open
8 tasks
nickrsan opened this issue Aug 27, 2024 · 1 comment
Open
8 tasks

Server-based dataset editing #62

nickrsan opened this issue Aug 27, 2024 · 1 comment
Assignees

Comments

@nickrsan
Copy link
Member

nickrsan commented Aug 27, 2024

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.

  • On close, detect it's server-based and upload it using ArcGIS API for Python.
  • If any of that fails, fall back to arcpy and it'll be read only. Right now we're relying on an arcpy flag to detect that it's read only, but that may not exist if we use the arcgis API for Python instead.
  • We may also want to allow people to use an itemid kwarg to ensure that pathway is taken.
@nickrsan nickrsan self-assigned this Aug 27, 2024
@nickrsan
Copy link
Member Author

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant