January 20, 2006

How I Build Geoprocessing Tools: #13 Documentation

Documentation

I try to get to the gym at least two times a week as part of my exercise regiment. Every once in a while a new machine arrives on the floor at the gym. Some new torture device with big gears, wires, pulleys, hinges and weights. I assume the device might have some benefit to me, but as I approach it I may not even know how to mount it. That's where those little pictures of people using the device pasted to the side really come in handy. I can do all I can to make a tool as intuitive as possible, but help is always a welcoming and comforting addition to the work since, if nothing else, it confirms our assumptions. It can also warn me against potential dangers of misuse, or compromises I must accept with its use.

I tested my tool with various forms of data, including CAD feature classes as input. Here is where my tool meets the real world of ugly/partially corrupt data, software limitations and compromise. Like I mentioned before, this blog is more reality show than tutorial. Here is the result of my testing: My tool works for POINTS, MULTI-Points, POLYLINE and POLYGONS with the exception of curves. An unfortunate compromise is that the GP scripting tools of ArcGIS 9.1 do not give me access to the curve definitions and therefore the curves are lost when saving to a new feature class. One way to ensure a better approximation with my tool would be to make my output featureclass a shapefile. This is because the first thing my script does is make a copy of the input. If I create an output Shapefile the curves are approximated as part of the copying function. If I specify a geodatabase output featureclass the curves will be retained when copied, but then they will be flattened out when my script modifies the copied features coordinates.

That said, I still have a solid solution for offsetting Points and a partial solution form shifting Polygons and Polylines. I won't bother spending any more blog time with the script itself lets move on...

I want to deploy my script tool. I have the two essential parts of a script, the script file and the GP script tool. They are linked and can communicate one with the other. I am not quite finished however. A good GP tool should have documentation and context help. I add my documentation to the script portion of the tool by selecting the Edit Metadata tool in ArcCatalog that is enabled when I highlight my OffsetMove tool in the data pane, and select the Metadata preview tab. The standard Metadata editor appears and I can type in the supporting help information. This way others can better understand what my tool does and how it works. Inside the script file itself I have added comment lines to define each action in the code and have includes some error trapping and user feedback.





I've renamed my tool to OffsetMove and will put it in my BlogTools toolbox. I will then publish the toolbox on ArcScripts once I add a couple of models that use my tool...

0 Comments:

Post a Comment

<< Home

FREE hit counter and Internet traffic statistics from freestats.com