Publishing spatial dataframe to featurelayer bug?

334
2
11-20-2023 08:49 PM
31337
by
New Contributor

I'm getting a strange error when trying to publish to AGOL a geodataframe that has been converted to a spatial dataframe.

sdf.spatial.to_featurelayer() produces the error: 

UnboundLocalError: local variable 'file' referenced before assignment

The error appears to be in the arcgis\gis\_impl\_content_manager\_import_data.py file.

_create_file_item() method passes in a dataframe argument (df) but the method is written so that it looks specifically for gdb, shapefiles, or csv's. It does not know how to handle a dataframe object and never creates the tempfile to store the data so when it tries to reference 'file' later on, there is no file and it crashes.


31337_0-1700541875810.png

I have not been able to use:

sdf.spatial.to_featureset()

or 

sdf.spatial.to_feature_collection()

or

sdf.spatial.to_featureclass()

They are all broken. 

Does anyone have a way to publish a geodataframe or spatial dataframe to AGOL using the API?

Thanks,

 

 

0 Kudos
2 Replies
NicholasGiner1
Esri Contributor

Hi - just to clarify, are you attempting this process?

GeoPandas GeoDataFrame > Spatially Enabled DataFrame > Hosted feature layer in AGOL?

0 Kudos
FEMARegion_II
New Contributor

Why did you post a reply to this if you never bothered to produce a suggested solution?

0 Kudos