Select to view content in your preferred language

Spatial DataFrame to Feature Class no longer overwrites output

1202
5
Jump to solution
04-05-2022 08:15 AM
JohnHuillery1
Occasional Contributor

The ...spatial.to_featureclass() method no longer overwrites the existing feature class.

Sample code:

 

 

import arcpy
import pandas as pd
from arcgis.features import Feature

arcpy.env.overwriteOutput = True

df = pd.DataFrame.spatial.from_featureclass(<valid featureclass>)
#modify features in some fashion 
df.spatial.to_featureclass(location=<path to existing feature class>, overwrite=True, sanitize_columns=False)

 

 

 

ArcGIS API for Python version 1.9.1

 

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
JianwuChen
New Contributor II

It works for me when I am using ArcGIS Pro 3.1.0. But the column aliases of the result output feature class are all the same as column names. The column aliases of the input feature class are not kept. That is the problem.

View solution in original post

5 Replies
jcarlson
MVP Esteemed Contributor

Are you using the ArcGIS Pro notebook environment? There are multiple other posts on here about this issue, seems to be a recent change.

I'd suggest using a separate Python env for this outside of Pro.

- Josh Carlson
Kendall County GIS
JohnHuillery1
Occasional Contributor

I use Spyder with a cloned env

jcarlson
MVP Esteemed Contributor

Interesting. Recent updates to the arcgis package or arcpy? You could try rolling back to a prior version and see if it works. I'm at 2.0.0, and am able to export to feature class without issue. But then, I don't use arcpy, so I don't know if that's where people are experiencing the issue.

- Josh Carlson
Kendall County GIS
0 Kudos
DavidAnderson_1701
Occasional Contributor

I just tested with the 1.9.1 in the stand along Jupyter notebook installed with ArcGIS Pro.  Worked fine for me.

How is it failing?   Does creating a new feature class still work if you give a slightly different name? 

Maybe it is slow? I had a recent, still unanswered question, noting that the export is very slow. spatial.to_featureclass is very slow in writing to... - Esri Community

0 Kudos
JianwuChen
New Contributor II

It works for me when I am using ArcGIS Pro 3.1.0. But the column aliases of the result output feature class are all the same as column names. The column aliases of the input feature class are not kept. That is the problem.