WARNING 001003: Datum conflict between input and output.

advertisement
Geography 376 Final Project
Kelly Knapp
May 14, 2010
Summary
This program runs a batch process on a set of raster datasets in a selected folder, saves a clipped version
and then converts it to another file format and saves it in an additional directory. The raster extents will
be clipped by a bounding polygon or a set of bounding coordinates provided by the user. These files will
be saved to the user defined output folder. The clipped files will be then converted to ASCII format and
saved to another user defined output folder.
This program is run from a CustomToolbox in ArcToolbox utilizing a custom tool GUI.
The required user inputs required for this tool are:
1. Location of raster images. (directory location).
2. Folder name for clipped rasters. (string)
3. Folder name for converted ASCII files. (string)
4. Existing Polygon for clipping extents (Shapefile) or coordinates for bounding extents. (Decimal
Degrees). The default coordinates are set to northern California, this was requested by the end
user.
5. A suffix to be concatenated to the original file names for the modified files. (string).
The optional user inputs for this tool are:
1. An existing raster or vector layer that will be used as the clip extent. (feature class)
2. If using the above clip boundary, choose to clip by the extent of the feature class or by its
polygon perimeter. (Boolean)
3. No Data Value - Pixels with the specified value will be set to NoData in the output raster dataset.
(long)
Purpose:
The purpose of this script is to provide an interface for some not so savvy GIS users to perform some
repetitive tasks to a large number of files quickly and easily. These scientists start with GRID files that
represent different bioclimatic variables such as Annual Mean Temperature or Precipitation of Warmest
Quarter for the entire world, so they are quite large. The first thing they need to do is clip the GRIDs
down to their desired location, typically Northern California. This script utilizes a listing routine and a
looping structure to retrieve the list of files in the directory and then automatically perform the
geoprocesses on the entire list. This allows flexibility to edit the script to perform additional or different
tasks if needed in the future.
I also wanted to learn more about customizing GUIs and their parameters for scripts. If there are tools
that are going to be used often enough, I prefer the ArcMap environment over a Python or Command
Window. It’s easier to have the GUI to point to different directories and data.
Tasks:
The two main geoprocessing tasks performed in this tool are Raster Clip and the Raster Conversion to
ASCII function. The Spatial Analyst extension must be loaded in order for this tool to function.
The program will first search to see if the output folders for the final rasters exist. If they do, they will be
deleted and then recreated.
A listing routine gathers the list of all raster files in the folder to be edited and displays their properties
in the window for information. Then the clipping process begins on the list of rasters. They are saved
and then converted to ASCII format and saved in another directory.
Difficulties/Challenges:

The first challenge was to find the exact tool that would perform the clipping task, yet also update
the extents of the new raster to its new boundary, releasing it of the whole world extents. Since the
files were raster files, I started my search in the Spatial Analyst toolbox. In the Extraction toolset,
there were likely candidates such as Extract by Polygon or Extract by Rectangle. After testing these
tools, it seemed to keep the original world extents. I expanded my search to the Data Management
Toolbox and under Raster/Raster Processing toolset, there was a Clip tool for raster inputs. This was
the tool that performed the clip on a raster dataset and ALSO shrunk the extents to either a user
entered bounding box of coordinates or through the use of a polygon.

The next challenge involved a datum conflict. The Clip tool has the option of providing a polygon for
its clipping extents and clipping along the polygon features. I wanted to include this option so I
created a shapefile as a test file. Trying to used this file seemed to create a datum conflict between
the input and the output. Even though I created the shapefile with acquired datum and coordinate
system from the original raster files. This was frustrating. Since it was only a “Warning” and the
tool still ran and seemed to not affect my routine, it was determined I could ignore the warning.
WARNING 001003: Datum conflict between input and output.

Can not print a Python list in a ArcGIS Status Window… which is a bummer because you don’t know
what the file names are before the process begins. Not a big deal, but it would be nice to be able to
see a list of the files you are going to modify.

Ideally it would’ve been nice for the user to have the ability to click a Browse Button to navigate to
the output location and create new folder names for the Clipped and ASCII folders. I had
programmed the output folders as variables, but since I was trying to use the same variable in the
Create Folder tool in my script it wouldn’t allow it. I tried changing the Datatype of the output
folders to Workspaces or Folders, but it wouldn’t work properly. The only way I was get it to work
was by changing the Datatype to a String. This string could then be used to create the folders in the
script. The only down side is that if you wanted the final files not as a subfolder in the original raster
folder, you would need to move the directory out of the original raster folder. I think there is an
option that I didn’t try by using the os.path.dirname(path) and os.path.basename(path) Python
snippets. I’ll look into that.
Creation of help file for the Tool Help: Utilized the ArcGIS Desktop help for a lot of the content since
it was exactly the same as my tool. No sense in recreating the wheel. Took some time to figure out
how to format it and get it to look like the ArcGIS Desktop Help (bullets and paragraphs)
Download