Hi,
When trying to use the Spatially Enabled Dataframe via a Jupyter Notebook:
sdf = pd.DataFrame.spatial.from_layer(featLayer)
sdf
I get the following error:
Exception: Could not load the dataset: Token Required
Token Required
(Error Code: 499)
My authentication to ArcGIS Online is OK, I can search and use content via the same authentication, but when i try the sdf, this error appears - does anyone have any suggestions?
this situation?
BUG-000136625: SpatialDataFrame.from_layer() returns the error: "Ex.. (esri.com)
I would post an issue on their github site
Esri/arcgis-python-api: Documentation and samples for ArcGIS API for Python (github.com)
they don't visit here often
Do you have access to that layer?
More details (code) will be helpful to pin-point the issue.
Yeah, so the layer is owned by myself and I am admin on the AGOL organisation in question, so there shouldn’t be any authentication issue, in actual fact if I try to create a sdf in a notebook in AGOL itself, it works perfectly using the same item and code, so it appears to be the OAuth2 authentication.
Once I’ve authenticated using my client ID and have a token, I use the following:
item = gis.content.get("itemid")
featLayer = item.layers[0]
sdf = pd.DataFrame.spatial.from_layer(featlayer)
I did a quick test on my portal, reproduced the error you are experiencing. It seems caused by the bug @DanPatterson mentioned above
We can only hope ESRI can get it fixed very soon.
In the meantime, except the "Alternative Solutions" mentioned by ESRI, another workaround is to Share the item to Everyone if it is an option.
The workaround apparently, wasn't tested and since the status is New, then that is the only alternative for the moment
Yup, I took your advice and posted as an issue on their github, hopefully they will get this fixed soon as it’s pretty frustrating and has me wondering if this is also the root cause of some other issues I’ve been experiencing between arcpy and AGOL.
I am also having the same issue and posted in the same issue. I am using esri living atlas layer for state boundary and having the exact same issue. I am puzzled since the same exact code worked up until few weeks ago. I think this is a major issue that needs to be addressed for anyone who is using Python API to create and process a spatially enabled dataframe.