Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have more than 1000 shape files (all are point features). They were initially in WGS 84. I projected them in UTM. Then through batch processing I added X, Y fields in each table. But all the X, Y fields are now empty or rather filled with 0. I need to calculate X, Y projected coordinate through batch processing and fill newly added X, Y fields. I checked in calculate field option for batch processing under data management tool. But don't see any calculate geometry option there. Where can I find the tool in the tool box so that I can use it for batch processing all my tables to calculate X, Y in meters. I am using ArcGIS

share|improve this question

1 Answer 1

up vote 7 down vote accepted

You can accomplish this in batch mode, in ModelBuilder and with Python.

Batch Mode:

  1. First delete your old XY fields using Delete Fields in batch mode. Right click on the tool and select "batch". Drag the files you want to process into the dialog box. The rows will automatically update to include all of the files you are processing.
  2. Choose the XY fields you want to delete > Fill
  3. Now add new XY fields. Search for the Add XY Coordinates (Data Management) tool in the Search tab. Right click the tool > Batch... (screenshot)
  4. Select the files you need to calculate in the Catalog and drag them over to the batch dialog box.
  5. Run the tool in batch mode. Note that the tool will automatically add an X and a Y field and calculate the coordinates.

enter image description here

Note that the can drag and drop multiple files from the highlighted section in Catalog, but only single files from the top window

enter image description here

ModelBuilder:

Same workflow as in batch mode, although it is much easier to string together commands in ModelBuilder.

enter image description here

Python

Again, the same workflow as above.

import arcpy

# The workspace where all your files are located
arcpy.env.workspace = r'C:\temp'

# Loop through the list of all your files
for fc in arcpy.ListFeatureClasses():
    arcpy.DeleteField_management (fc, ['x','y']) # Delete the old fields
    arcpy.AddXY_management (fc) # Add XY fields again and calculate coords
share|improve this answer
    
Thank you for your answer. Although I am using batch mode, but I cannot select all the files in one go. I have to select the files one by one for each row. How can I select all the files together? –  user26161 Aug 20 at 8:36
    
When you browse for a file from the batch window, you can select multiple files. It will then add a new row per file. Alternatively, select all the files in windows explorer or ArcCatalog and you can drag and drop them into the batch window. This will populate it with a row per shapefile. But it will be easier to run this as a python script or an iterating model like Aaron has shown you above. –  Dan_h_b Aug 20 at 12:36
    
@user26161 As Dan pointed out, you can drag and drop multiple files from catalog. I updated the post to include more information on how to do that. –  Aaron Aug 20 at 16:15
    
Thank you very much Aaron and Dan –  user26161 Aug 21 at 1:45
    
@user26161 You should accept the answer. –  ian Aug 21 at 5:05

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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