Error after publishing the Spatially Enabled DataFrame

215
1
09-09-2020 10:11 PM
simoxu
by MVP Regular Contributor
MVP Regular Contributor

I am trying to publish a SEDF to ArcGIS Portal. In the Jupyter notebook, it indicates it succeeded after I run 

my_sedf.spatial.to_featurelayer("new layer name")

but when I go to portal to inspect the published service, there's an error despite the service seems working OK.

I have to overwrite the web layer from ArcGIS Pro to get rid of this error. 

Is there a tiny bug in the API?

0 Kudos
1 Reply
RobertWeber
New Contributor III

I am seeing something similar where publishing from a SDF like sdf.spatial.to_featurelayer() creates the layer but there are no features.

I have followed the https://developers.arcgis.com/python/sample-notebooks/html-table-to-pandas-data-frame-to-portal-item... example but in my case I only need to produce the SDF from known Lat Long fields so I use the following code basically I have tried all the methods out there and all produce broken services or services with features that only show up in the map view classic?  No Idea.

 

sdf = pd.read_excel("combined gis.xlsx")

#used this as a work around to try instead of the from_xy() same result lat longs are backward in my sheet 
sdf['SHAPE'] = sdf.apply(lambda row : arcgis.geometry.Geometry({'x': row['Long'], 'y': row['Lat'], 'spatialReference': {'wkid': 4326}}), axis=1 )

sdf.spatial.set_geometry(sdf['SHAPE'])
#used this but produces a empty service but the sdf plots fine in the map in my browser
# sdf = dataframe1.spatial.from_xy(dataframe1, x_column='Long', y_column='Lat')

print(len(sdf))
#filtered features with 0,0 in case that was causing a problem
sdf = sdf[sdf.Lat != 0]
print(len(sdf))
print(sdf.spatial.sr)
# print(sdf)

#the import just creates an empty service
# fc = gis.content.import_data(sdf)

#this also creates an empty service
lyr = sdf.spatial.to_featurelayer('EMPTY USELESS LAYER', gis)

#sdf plots fine in the jupyter notebook browser
map1 = gis.map()
map1.add_layer(sdf)
map1

 

This workflow has never worked for me and so I have always just saved things locally to a feature class in FGDB then published from there.  If anyone has any ideas I am listening!  from_xy is simple enough but there is something happening when I try to import it or publish it - maybe with the projection?  Maybe I am missing something simple.

I have looked at all samples and people have had similar issues but this scenario is even more basic than most and it doesn't work.

Thanks!

0 Kudos