I'm converting geopackages to features in a file geodatabase using Copy Features. For some reason the geometry column is named geom instead of the usual Shape and I want to rename it to Shape:

enter image description here

I have tried:

  • Alter Field but the geometry column is greyed out
  • Make Feature Layer of the geopackage and renaming column then Copy Features but the column is still named geom.
  • I have read this thread How do you change the geometry field name?, but the solution seems to require manual loading of data

How can I rename the geometry column?

  • See this answer, maybe it can help you. gis.stackexchange.com/questions/234126/… – vada Nov 19 '18 at 8:51
  • 1
    @vada I need to rename them, that answer is how to reference them using tokens – BERA Nov 19 '18 at 9:15
  • @BERA What about changing just alias? Or making a FeatureClass to FeatureClass conversion? – Pavel Pereverzev Nov 19 '18 at 9:30
  • Adding new column, copying values and deleting geom_area is not an option? – JuniorPythonNewbie Nov 19 '18 at 9:45
  • 3
    File geodatabase only allows one geometry column per table, so add-copy-delete is not an option. If you want to change the name, you'll need to reload the data. – Vince Nov 19 '18 at 11:42

I've come across this irritating problem in the past which has implications for tools that have not been developed robustly enough to deal with the situation when the geometry field is not called SHAPE, a standard that has been in place for many years. My gut feeling is that it is done by people who don't realise the ramifications and are changing it because they can change it, I'm guessing people in the open source community?

ESRI tools like featureclass to featureclass won't allow you to map geometry fields in the field mapping. The only way to resolve this is to create an empty featureclass where the geometry field is called SHAPE, import the field structure from the source dataset and either use the GUI to Load data or you can use the Append tool.

I've also come across situations where the OBJECTID is not called OBJECTID. You would have to follow the same procedure.

| improve this answer | |
  • 1
    In this case user wants to convert data from a standard GeoPackage into ESRI FileGDB by using the tools offered by ArcGIS desktop so it feels like open source community is not involved. On the other hand GDAL driver that is using the API from ESRI seems to use SHAPE as the default name for the geometry gdal.org/drv_filegdb.html but user can select another name. – user30184 Nov 19 '18 at 20:44
  • Other GIS systems can allow for multi-geometry fields (and types) on a single table, therefore having the geometry field name default to 'SHAPE' would pose a limitation on this capability. – nr_aus Aug 20 at 4:35

A workaround is to create an empty feature class, add all fields except OID and geometry and append the data:

import arcpy, os    
geopackage = r'C:\folder\testdata.gpkg\main.testdata'    
arcpy.MakeFeatureLayer_management(in_features=geopackage, out_layer='templyr')
fields = [f for f in arcpy.ListFields(dataset='templyr') if f.type not in ("Geometry","OID")]
arcpy.CreateFeatureclass_management(out_path=r'C:\folder\Default.gdb', out_name='somename', 
                                    geometry_type='POLYGON', spatial_reference=arcpy.SpatialReference(3006))
for field in fields:
                              field_name=field.name, field_type=field.type, field_length=field.length) 
arcpy.Append_management(inputs='templyr', target=os.path.join(r'C:\folder\Default.gdb','somename'))


| improve this answer | |
  • 1
    +1 This is the sort of code I think could be packaged up into a nice scripting tool for a useful utility toolbox and distributed on the ESRI code sharing website. A future project when deadlines are not looming! – Hornbydd Nov 19 '18 at 14:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.