arcgis-python-api
arcgis-python-api copied to clipboard
GeoAccessor.to_featureclass function converting all column names to lowercase when sanitize_columns parameter is True
Describe the bug
When using the GeoAccessor.to_featureclass to export a spatial dataframe to a shapefile, if you pass sanitize_columns
as True
it converts all the column names to lowercase.
The sanitize_columns
param is True
by default so this happens automatically.
To Reproduce Steps to reproduce the behavior:
import arcgis
gis = arcgis.GIS()
ITEM_ID = "9df5e769bfe8412b8de36a2e618c7672"
OUTPUT_FOLDER = "/tmp"
df = arcgis.features.GeoAccessor.from_layer(arcgis.features.FeatureLayer.fromitem(gis.content.get(ITEM_ID)))
df.spatial.to_featureclass(location=OUTPUT_FOLDER + "/usa_major_cities", sanitize_columns=True)
Expected behavior I expected the columns names to be sanitized of special characters, not converted to lowercase.
Platform (please complete the following information):
- OS: Windows 10
- Python API Version [e.g.
2.1.0.4
Additional context
Is this expected behaviour? If so please update the docs to specify this side effect. It would be better to have this parameter set to False
by default, as it behaves now, the end shapefile has been altered in a way that the programmer may not have intended. (The GeoAccessor.to_featurelayer
has it's sanitize_columns
default set to False
).
Related issue: https://github.com/Esri/arcgis-python-api/issues/923
@ManushiM Can you advise on this?