Select to view content in your preferred language

Spatially Enabled Dataframe issues

2250
6
Jump to solution
12-05-2018 02:42 PM
MatthewSkewes2
Occasional Contributor

Hi

I previously used the SpatialDataFrame object to access online feature services. With the update of the API to 1.5.1, I have tried to utlise the new Spatially Enabled Dataframe object in the same way, as that appears to be preferred way going forward but I'm running into issues trying to access the same dataset I had no issues accessing with a SpatialDataFrame.

This is the error I receive when I use the simple code below 

Exception: Could not load the dataset: cannot perform __truediv__ with this index type: DatetimeIndex

item = gis.content.get("ItemID")
flayer = item.layers[1]
sdf = pd.DataFrame.spatial.from_layer(flayer)

I'm using Python  3.6.7 with the latest version of ArcGISPro

Has anyone had similar issues?

0 Kudos
1 Solution

Accepted Solutions
JohnYaist1
Esri Contributor

Hi Matthew Skewes 

We've fixed an issue with the Spatially Enabled Dataframe `from_layer()` method that will be available in tomorrow morning's release. Can you run the code after updating the api to 1.5.2 tomorrow and let me now if that addresses the issue?

View solution in original post

6 Replies
JoshuaBixby
MVP Esteemed Contributor

The example code from Introduction to the Spatial DataFrame | ArcGIS for Developers works for me:

from arcgis.features import SpatialDataFrame
from arcgis import GIS

gis = (url, username, password)
item = gis.content.get("id")
flayer = item.layers[0]
sdf = SpatialDataFrame.from_layer(flayer)
DanPatterson_Retired
MVP Emeritus

The error seems to be with datetime... do you have datetime field(s) in your dataset?

0 Kudos
JohnYaist1
Esri Contributor

Hi Matthew Skewes 

We've fixed an issue with the Spatially Enabled Dataframe `from_layer()` method that will be available in tomorrow morning's release. Can you run the code after updating the api to 1.5.2 tomorrow and let me now if that addresses the issue?

MatthewSkewes2
Occasional Contributor

Hi John Yaist

That sounds promising, I'll let you know how it goes after the update.

Cheers

0 Kudos
MatthewSkewes2
Occasional Contributor

John Yaist the update fixes the issue and using the new object has also has improved the time taken to run the script considerably.

Cheers

0 Kudos
JohnYaist1
Esri Contributor

Sweet! Thanks for the follow-up, Matthew Skewes. Bonus on the performance boost - we're always investigating ways to improve on that...good to hear!

0 Kudos