Error 498 while creating Spatial Data Frame using ArcGIS Online Notebooks, and a workaround

648
2
10-22-2021 10:17 AM
AaronKoelker
Occasional Contributor III

This is more of a notice than a question, but perhaps someone can confirm what I've found.

Below is a snippet of code to create a spatially enabled data frame from a web layer. The layer is coming from a Federated Server/Portal, rather than an ArcGIS Online hosted feature layer. Running the script results in error code (498): Invalid Token. This does not occur when using hosted feature layers stored in ArcGIS Online, but does occur with other layers stored in our Portal. Using an enterprise vs built-in ArcGIS Online account doesn't make a difference, and the items are shared publicly. Data opens fine in a web map.

 

from arcgis.gis import GIS
import pandas as pd
gis = GIS("home")

npdesOD = gis.content.get("1550e796acb346baa743e90c13a19bf4").layers[0]
npdesOD_sdf = pd.DataFrame.spatial.from_layer(npdesOD)
npdesOD_sdf.head()

 

 

I have an older script that was created several months prior which uses the same workflow to create a spatially enabled dataframe, and it runs without issue. I can copy that exact working code into a new AGO Notebook and it will fail with error code 498, though. Looking at the Info tab for the Notebook, I realized that the older, working Notebook is using the 4.0 Runtime, while all new Notebooks I create are using the 5.0 Runtime. 

As a workaround for this issue, I was able to 'Save As' the old 4.0 Notebook, then delete the contents and write my new script to get around the bug. This works fine. However I'm hoping that the issue will be fixed for the 5.0 Runtime Notebooks, so that this workaround isn't needed. It also doesn't help users who don't have an old Notebook lying around.

-Aaron
0 Kudos
2 Replies
by Anonymous User
Not applicable

Hi Aaron - I'm currently looking into why this would work for you in 4.0 but not 5.0. In the meantime, I should mention that we provide versioning for all the notebook runtimes - you are able to change an existing notebook to any previous runtime via the settings tab on the item, all the way back to 1.0.

AaronKoelker
Occasional Contributor III

@Anonymous UserAha! Thank you Josh, I looked all through the Notebook itself for an option to update the version but didn't think to check the Settings on the item detail page. That is very helpful.

-Aaron
0 Kudos