Select to view content in your preferred language

Publishing Spatially Enabled Dataframe using the to_featurelayer() Method Fails

638
2
02-27-2023 04:49 PM
GraceTortorici_
New Contributor III

Publishing Spatially Enabled Dataframe using the to_featurelayer() Method Fails with a generic "job failed" error at 960 columns. We have tried running the same script with just the 960th column to rule that out, and the script ran successfully and produced no error. In AGOL, a shapefile and HFL are created, but when we click on the HFL, we get error "there was an error publishing this service."

Based on this, we believe that the error is occurring when the shp is being promoted to a HFL. We tested reimporting the generated shp to our AGOL contents and promoted it to a HFL by hand, and we got the same error. We can narrow down our script to this error. This is not a customization case, we need help identifying why this error is happening in our line of code. It could be a bug because it happens outside of the script as well.

Here is the line of code: sdf_buildings_merged.spatial.to_featurelayer('layername')

For your background, this is the last step of a workflow that involved merging non spatial data into this spatially enabled dataframe before publishing to AGOL.

 

@JamesCrandall  @Kepa any insights would be appreciated 🙂

0 Kudos
2 Replies
Kepa
by Esri Contributor
Esri Contributor

Hello @GraceTortorici_

Just to put some context, we are assuming the script is being executed on ArcGIS PRO Python console or on a Notebook, right? You create a spatially enabled dataframe (sdf) from a shapefile, add/merge/join some non-spatial data and finally publish a hosted feature layer directly from the sdf on AGOL.

It's rather difficult to make a guess without having the original data but that error at column #960 it's very specific. Please, verify if there is any unsupported value/s or character/s around it. Also, if possible, try reading spatial data from a FileGDB instead of a shapefile.

Regards,

0 Kudos
DavidAnderson_1701
Occasional Contributor

I don't have a solution as I've had issues with the SEDF to_featurelayer or to_featureclass functionality.

Looking at the github for the API, 5 of the 30 open issues are around this issue.  I hope the ESRI staff are noting that there are some issues with getting data from SEDF's back into spatial data formats.