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.
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,
Hi - just to clarify, are you attempting this process?
GeoPandas GeoDataFrame > Spatially Enabled DataFrame > Hosted feature layer in AGOL?
Why did you post a reply to this if you never bothered to produce a suggested solution?