Select to view content in your preferred language

Spatially enabled dataframe overwrite layer breaking spatial reference

461
2
09-25-2024 11:20 AM
DougZietz1
Occasional Contributor

The process goes as such:

  1. I create my sedf from a df using a geometry field and declare the wkid in the spatial reference.
  2. Publish the sedf as a new feature layer with only name and the gis. It works as expected.
  3. I run the same script but instead of creating a new feature layer, I overwrite. It changes the projection.

from arcgis.geometry import SpatialReference

sr = SpatialReference(wkid=4326) # WGS 84
sedf = pd.DataFrame.spatial.from_df(df,geometry_column='geometry',sr=sr)

lyr = sedf.spatial.to_featurelayer('feat_layer_name', gis=gis) # works correctly

lyr = sedf.spatial.to_featurelayer(gis=gis,overwrite=True,service={'featureServiceId':'1234567890abcdefgh','layer':0}) # breaks projection

 

Seems like a bug. I'd rather not have to go back to the old method of updating feature layers as this should be the standard.

2 Replies
DougZietz1
Occasional Contributor

Oh yeah, it also keeps creating extra shapefiles and feature layers...

0 Kudos
DougZietz1
Occasional Contributor

... and oh yeah, it also truncates the headers.

0 Kudos