0

I am trying to change the projection system of 100+ feature classes from projected to WGS84 using Python.

I am exporting the geodatabase to xml (Schema only) and changing the projection parameters in xml and then creating a geodatabase from that new xml. Normally, in ArcGIS Desktop, if I have the data and I change the projection then I have to apply projection transformation as well.

If I do not have any data inside a geodatabase then do I need to apply transformation?

2

If there's no data, then no, there are no coordinates to be transformed and therefore no transformation (reprojection) to be done.

As an alternative method, without having to export/import with XML, you could iterate through all the feature classes in the GDB and for each one, create a new empty feature classes based on the existing feature class' schema. You can do this as well as specify the spatial reference all in one arcpy command (per feature class) using arcpy.CreateFeatureclass_management() ( doco )

Something like:

arcpy.CreateFeatureclass_management(newGDB, newFCName, arcpy.Describe(oldFC).shapeType, oldFC, spatial_reference=newSpatialReference)

The new spatial reference can be specified in a variety of ways, including passing a FC with the new spatial reference, or an EPSG number.

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.