My GPS collects data in WGS1984 and I have decided to start working in UTM instead of state plane. Needless to say, I would edit shapefiles, not paying attention to what coordinate system I was using and relied on the transformations. I have realized the error of my ways and want to correct my workflow.

I would like to take my original files from my gps and do a batch project to UTM so I can correct the data. The directory structure of my gps software is such that each project has it's own folder with subdirectories of corrected/uncorrected data and the shapefiles. I would like to be able to load up the tool with the various files from different locations and save the UTM file to the same directory as the WGS1984 file, just with UTM at the end of the file name.

What I have done is made a copy of the BatchProject script from ArcToolbox to modify, but I have little to no experience with Python. If this is not the way to approach this problem, please let me know. If I should be using just the regular project tool and put that inside of a loop of some sort, that's fine too.

  • What version of ArcGIS for Desktop are you using? You can edit your Question to include this important detail. – PolyGeo Dec 9 '13 at 20:49

Assuming you are using ArcGIS 10, following is a script based on the batch project example from here. This function, unfortunately, does not provide any control over the output name, and all results are dumped into the same directory. If that is a key requirement, then you may be better off writing some sort of loop that takes the input name and adds "_utm" to the output at each step.

import arcpy
from arcpy import env
import fnmatch
import os

# Name: BatchProject.py
# Description: Changes coordinate systems of several datasets in a batch.

# Set workspace environment to root of drive that has your GPS shapes
env.workspace = 'c:/change/me'

# use os.walk to recursively find shapefiles from root
input_features = []
for root, dirnames, filenames in os.walk(env.workspace):
  for filename in fnmatch.filter(filenames, '*.shp'):
      input_features.append(os.path.abspath(os.path.join(root, filename)))

# Set output directory
out_workspace = 'c:/change/me_too'

# Output coordinate system - make sure to change this to the one you want to use
out_cs = "Coordinate Systems/Projected Coordinate Systems/UTM/WGS 1984/Northern Hemisphere/WGS 1984 UTM Zone 18N.prj"

# Template dataset - not used in this example, leave blank
template = ''

# Geographic transformation (optional) - make sure to change or delete this, as applicable
transformation = "WGS_1972_To_WGS_1984_1"

   res = arcpy.BatchProject(input_features, out_workspace, out_cs, template, transformation)
   if res.maxSeverity == 0:
      print "projection of all datasets successful"
      print "failed to project one or more datasets"
   print res.getMessages()

I haven't tested this! In particular, I'm not sure how putting env.workspace in as the root of os.walk will work, but you can always change that out for a root directory of your choice.


I do not want to dissuade you from a python based approach, however, ModelBuilder has a very handy recursive iterator that will walk through folders and sub folders (Figure 2). From there use Parse Path to manipulate the path so that you can place the projected files in the same folders as the WGS data (Figure 3). Make sure to connect "Name" and "Value" to the project tool with a precondition (i.e. dotted connector). Finally, put it all together within the project tool using "%Value%\%Name%_utm" in the output dataset box (Figure 4).

Figure 1 enter image description here

Figure 2

enter image description here

Figure 3

enter image description here

Figure 4

enter image description here

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.