arcpy.FeatureClassToGeodatabase_conversion names problem

1724
5
08-13-2012 08:07 AM
LucaMoiana
New Contributor
Hi there,

For what I am trying to do I create a list of .shp files that I want to import in a gdb, then I use a loop such as:

for fc in list:
arcpy.FeatureClassToGeodatabase_conversion names problem(fc, out_gdb)
It all works smooth except that the feature class created are named "GPL..."
why?
Is there any way I can specify the featureclass name that I want to have in the gdb?

Thanks for your help
Tags (2)
0 Kudos
5 Replies
BruceBacia
Occasional Contributor
Use arcpy.FeatureClasstoFeatureClass instead.   You can specify the name and location of the output fc.
0 Kudos
LucaMoiana
New Contributor
Use arcpy.FeatureClasstoFeatureClass instead.   You can specify the name and location of the output fc.


That's what I did.
Thanks
0 Kudos
KenCarrier
Occasional Contributor III
Sure there is a way

FeatureClassToFeatureClass(in_features=None, out_path=None, out_name=None, where_clause=None, field_mapping=None, config_keyword=None)

Notice the third parameter is out_name, this is where you would specify the featureclass name.
0 Kudos
LucaMoiana
New Contributor
Sure there is a way

FeatureClassToFeatureClass(in_features=None, out_path=None, out_name=None, where_clause=None, field_mapping=None, config_keyword=None)

Notice the third parameter is out_name, this is where you would specify the featureclass name.


So, the only way is to use FeatureClassToFeatureClass, there's no way to use FeatureClassToGeodatabase?

Other question is, when I use FeatureClassToFeatureClass the Feautures I create have no Spatial Reference, how do I do??
0 Kudos
KenCarrier
Occasional Contributor III
FeatureClasstoFeatureClass will give you the desired result of being able to name your featureclasses the way you want. It is essentially the same thing as FeatureclasstoGeodatabase but with more options and flexibility.

The FeatureClasstoFeatureClass tool does carry over spatial data like projections so I would check to ensure that the shapefiles have a projection associated with them.

I would possibly use the define projection on the shapefiles before executing the FeatureClasstoFeatureClass tool if that is the case

I would start with making sure the shapefiles you are importing have a spatial reference though.
0 Kudos