<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.esri.com/Dev/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Geoprocessing : advanced</title><link>http://blogs.esri.com/Dev/blogs/geoprocessing/archive/tags/advanced/default.aspx</link><description>Tags: advanced</description><dc:language>en</dc:language><generator>CommunityServer 2.1 SP2 (Debug Build: 61120.2)</generator><item><title>Lidar Solutions in ArcGIS_part6: Updating a portion of a terrain dataset with new measurements</title><link>http://blogs.esri.com/Dev/blogs/geoprocessing/archive/2009/07/02/Lidar-Solutions-in-ArcGIS_5F00_part6_3A00_-Updating-a-portion-of-a-terrain-dataset-with-new-measurements.aspx</link><pubDate>Thu, 02 Jul 2009 17:36:00 GMT</pubDate><guid isPermaLink="false">b60b3f0a-e2bd-4be5-8a18-822c697649ab:6740</guid><dc:creator>bbicking1</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.esri.com/Dev/blogs/geoprocessing/comments/6740.aspx</comments><wfw:commentRss>http://blogs.esri.com/Dev/blogs/geoprocessing/commentrss.aspx?PostID=6740</wfw:commentRss><description>&lt;P&gt;&lt;EM&gt;This is the sixth blog in a series on Lidar Solutions in ArcGIS. The author of this blog is Clayton Crawford, lead Product Engineer on ESRI's 3D Analyst team in the Software Products group in Redlands.&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;Updating a portion of a terrain dataset with new measurements&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;The ability to update a surface is important to people responsible for providing accurate, up to date surfaces and people performing analysis on those surfaces. Updates come in different forms:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Adding ancillary data (e.g., breaklines)&lt;/LI&gt;
&lt;LI&gt;Removing or replacing bad data&lt;/LI&gt;
&lt;LI&gt;Using newer or more accurate data&lt;/LI&gt;
&lt;LI&gt;Increasing extent with additional data&lt;/LI&gt;
&lt;LI&gt;Inserting design/modeled data to perform ‘what-if’ analysis&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;These kinds of updates are best performed on the measurements used to construct a surface rather than on derivatives like raster DEMs. Those can be recreated as needed after the measurement edits have taken place. Terrain datasets support this editing model because they maintain a direct link to the source measurement data. When you modify the measurements, you are automatically modifying the terrain in the same process.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;How terrains are edited&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Editing a terrain dataset is really about editing measurements. Using standard feature edit tools, you can manipulate the measurements that reside in feature classes that participate in a terrain.&lt;/P&gt;
&lt;P&gt;Terrains are made from one or more feature classes with some simple rules for each that control how they get used to shape the terrain surface. For example, a multipoint feature class containing lidar points can get added as mass points, a line feature class containing streams and lake shores is used as a source of breaklines, and a polygon feature class can control the data area boundary.&lt;/P&gt;
&lt;P&gt;Most feature classes used to define a terrain are what we call &lt;EM&gt;referenced&lt;/EM&gt;. This means that the terrain maintains a pointer, or handle, to them. The terrain prevents its referenced feature classes from being deleted, and pays attention to any edits that occur on them including the addition, deletion, or modification of feature geometry. You can use the feature editor in ArcMap as well as geoprocessing tools to modify these feature classes. A terrain will automatically flag itself as ‘dirty’ in areas where edits were made. Then the terrain can be rebuilt to bring its pyramid in sync with the updated features. It does this based on the dirty areas so it’s a local, or partial, process; the entire terrain does not need to be reconstructed.&lt;/P&gt;
&lt;P&gt;Multipoint feature classes have the option of being &lt;EM&gt;embedded&lt;/EM&gt;. When multipoints are embedded the terrain build process copies the points into pyramid tables held private by the terrain and it becomes the container for the points. The terrain does not reference the source feature class. That can be deleted, allowing you to retrieve what is typically a substantial amount of disk space; approximately 1GB per 150 million points. Terrain specific tools, Add Terrain Points (which can both add and replace) and Remove Terrain Points, are used to edit the embedded points based on an area of interest. These tools also offer the benefit of being BLOB attribute aware so if you have any LAS attributes stored with those multipoints (for more on this topic see &lt;A class="" title="blog on creating intensity images" href="http://blogs.esri.com/Dev/blogs/geoprocessing/archive/2009/05/12/Lidar-Solutions-in-ArcGIS_5F00_part5_3A00_-Creating-Intensity-Images-from-Lidar.aspx" target=_blank&gt;blog on creating intensity images&lt;/A&gt;) the tools know how to keep the BLOB based values in sync with the points relative to the edits. For example, if a few vertices of a multipoint are deleted from an embedded feature class, the terrain will delete the corresponding BLOB based attribute values for those points.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Appending measurements&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Measurements can be added to a terrain via the Append and Add Terrain Points geoprocessing tools. The Append tool operates on regular (&lt;EM&gt;referenced&lt;/EM&gt;) feature classes. The Add Terrain Points tool is used to add or replace points in &lt;EM&gt;embedded&lt;/EM&gt; feature classes. You can also add a feature class to an existing terrain via the Add Feature Class To Terrain tool but be aware that this is treated as a schema edit that invalidates the entire terrain, requiring a full rebuild. If data is to be added incrementally, it’s best to append it to a feature class that already participates in the terrain than add a new feature class to the terrain for each new set of data.&lt;/P&gt;
&lt;P&gt;Let’s take a scenario where data is provided in phases. In this example the bare earth lidar points are made available first. The breaklines come later in several deliveries. Knowing this schedule, you can create a terrain referencing the lidar multipoint feature class plus an empty line feature class held in anticipation of the breaklines. See Figure 1 with a zoomed-in view of a terrain made solely with bare earth lidar points.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;A href="http://blogs.esri.com/Dev/photos/geoprocessing/picture6730.aspx" target=_blank&gt;&lt;IMG src="http://blogs.esri.com/Dev/photos/geoprocessing/images/6730/416x298.aspx" border=0&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;When some of the breaklines are made available they are added to the terrain by adding them to the line feature class referenced by the terrain. This is done using the geoprocessing Append tool (Figure 2).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;A href="http://blogs.esri.com/Dev/photos/geoprocessing/picture6731.aspx" target=_blank&gt;&lt;IMG src="http://blogs.esri.com/Dev/photos/geoprocessing/images/6731/407x399.aspx" border=0&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;After running Append, the terrain will become ‘dirty’ in the areas where the lines were added. To see the dirty areas you add a dirty area renderer from the Symbology tab of the terrain layer Properties dialog (Figures 3a and 3b).&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.esri.com/Dev/photos/geoprocessing/picture6734.aspx" target=_blank&gt;&lt;IMG src="http://blogs.esri.com/Dev/photos/geoprocessing/images/6734/582x468.aspx" border=0&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.esri.com/Dev/photos/geoprocessing/picture6735.aspx" target=_blank&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.esri.com/Dev/photos/geoprocessing/picture6730.aspx" target=_blank&gt;&lt;/A&gt;&lt;A href="http://blogs.esri.com/Dev/photos/geoprocessing/picture6735.aspx" target=_blank&gt;&lt;IMG src="http://blogs.esri.com/Dev/photos/geoprocessing/images/6735/434x319.aspx" border=0&gt;&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;At this point the terrain needs to be rebuilt. This is done using either the Build Terrain geoprocessing tool or the Build button on the Update tab of the terrain Properties dialog in ArcCatalog. Once the terrain is re-built the improvement made by the breaklines is evident (Figure 4).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;A href="http://blogs.esri.com/Dev/photos/geoprocessing/picture6736.aspx" target=_blank&gt;&lt;IMG src="http://blogs.esri.com/Dev/photos/geoprocessing/images/6736/418x319.aspx" border=0&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Replace&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;With lines and polygons in &lt;EM&gt;referenced&lt;/EM&gt; feature classes the replacement of measurements is a two step process. First you delete the old then append the new. If you’re only dealing with a handful of features then you can select and delete them using the Editor in ArcMap. For larger collections rely on geoprocessing tools. For example, use Select By Location followed by Delete Features and Append.&lt;/P&gt;
&lt;P&gt;It’s easiest to replace lidar points if they’re &lt;EM&gt;embedded&lt;/EM&gt;. There’s a geoprocessing tool called Add Terrain Points that has a Replace option. This will replace all the points within a given area. So, if you discover something was wrong with a few source point files that were used to build a terrain you can replace them without needing to rebuild the entire terrain from scratch. Figure 5 shows an example where one area, in an otherwise bare earth model, that was inadvertently loaded with first return data.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.esri.com/Dev/photos/geoprocessing/picture6737.aspx" target=_blank&gt;&lt;IMG src="http://blogs.esri.com/Dev/photos/geoprocessing/images/6737/517x213.aspx" border=0&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;To fix this problem load the replacement data into a new multipoint feature class. Then run the Add Terrain Points tool with the Replace option. By default, the replacement area will come from the extent of the input feature class (Figure 6).&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.esri.com/Dev/photos/geoprocessing/picture6738.aspx" target=_blank&gt;&lt;IMG src="http://blogs.esri.com/Dev/photos/geoprocessing/images/6738/405x381.aspx" border=0&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Once the points have been replaced the terrain needs to be rebuilt to update the affected area. Run the Build Terrain geoprocessing tool or use the Build Terrain button on the Update tab of the terrain Properties dialog in ArcCatalog – either one fixes the terrain.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Conclusion&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;There are times when updates to a surface model are needed, be it for quality improvement or what-if scenario analysis. It’s hard to make these types of updates to derivative products like raster DEMs without ending up with some anomalies around the update area. It’s more appropriate to modify the source measurement data from which the surface model is derived. For larger datasets, like those coming from lidar, it’s also desirable that datasets only be reprocessed where the updates occur rather than rebuilding everything. Terrain datasets support this by maintaining links to their source measurements in the geodatabase and their use of dirty areas.&lt;/P&gt;
&lt;P&gt;That concludes part 6 of Lidar Solutions in ArcGIS. Subscribe to this blog or check back in a month or so for a discussion on how to minimize noise from lidar for contouring and slope analysis.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://blogs.esri.com/Dev/aggbug.aspx?PostID=6740" width="1" height="1"&gt;</description><category domain="http://blogs.esri.com/Dev/blogs/geoprocessing/archive/tags/beginner/default.aspx">beginner</category><category domain="http://blogs.esri.com/Dev/blogs/geoprocessing/archive/tags/advanced/default.aspx">advanced</category><category domain="http://blogs.esri.com/Dev/blogs/geoprocessing/archive/tags/3D+Lidar+Point+Data/default.aspx">3D Lidar Point Data</category></item><item><title>Lidar Solutions in ArcGIS_part5: Creating Intensity Images from Lidar</title><link>http://blogs.esri.com/Dev/blogs/geoprocessing/archive/2009/05/12/Lidar-Solutions-in-ArcGIS_5F00_part5_3A00_-Creating-Intensity-Images-from-Lidar.aspx</link><pubDate>Tue, 12 May 2009 20:50:00 GMT</pubDate><guid isPermaLink="false">b60b3f0a-e2bd-4be5-8a18-822c697649ab:5854</guid><dc:creator>bbicking1</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.esri.com/Dev/blogs/geoprocessing/comments/5854.aspx</comments><wfw:commentRss>http://blogs.esri.com/Dev/blogs/geoprocessing/commentrss.aspx?PostID=5854</wfw:commentRss><description>&lt;P&gt;&lt;EM&gt;This is the fifth blog in a series on Lidar Solutions in ArcGIS. It was written by Clayton Crawford, Product Engineer on the 3D Analyst team in ESRI’s Software Products group in Redlands.&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Creating Intensity Images from Lidar&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Intensity is a measure, collected for every point, of the return strength of the laser pulse that generated the point. It’s based, in part, on the reflectivity of the object struck by the pulse. Other descriptions for intensity include ‘return pulse amplitude’ and ‘backscattered intensity of reflection’. Keep in mind, the reflectivity is a function of the wavelength used which is most commonly in the near infrared. Intensity is used as an aid in feature detection and extraction, lidar point classification, and as a substitute for aerial imagery when none is available. If your lidar points include intensity values you can make images from them that look something like black and white aerial photos (Figure 1).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;A href="http://blogs.esri.com/Dev/photos/geoprocessing/picture5848.aspx" target=_blank&gt;&lt;IMG src="http://blogs.esri.com/Dev/photos/geoprocessing/images/5848/419x323.aspx" border=0&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;Loading points with intensity&lt;/EM&gt;&lt;/STRONG&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You'll need source lidar in either LAS or ASCII XYZI format. It’s common to use first returns. If your data are in LAS format use the LAS To Multipoint tool with Intensity selected as an attribute to import (Figure 2). If your data are in ASCII XYZI format use the ASCII 3D To Feature Class tool.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;A href="http://blogs.esri.com/Dev/photos/geoprocessing/picture5849.aspx" target=_blank&gt;&lt;IMG src="http://blogs.esri.com/Dev/photos/geoprocessing/images/5849/452x408.aspx" border=0&gt;&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The data loading process results in a multipoint feature class with an attribute field containing the intensity values (Figure 3). You can't read these directly because they're packed into BLOBs (Binary Large OBjects). Every vertex of a multipoint has its intensity mapped into the BLOB stored for that multipoint record.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;A href="http://blogs.esri.com/Dev/photos/geoprocessing/picture5850.aspx" target=_blank&gt;&lt;IMG src="http://blogs.esri.com/Dev/photos/geoprocessing/images/5850/392x303.aspx" border=0&gt;&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;Substituting intensity for z&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;A custom VBA script is used to replace every multipoint vertex z with intensity. It does this on a copy of the data. Find the script here; to use it follow the instructions included in the &lt;A class="" title=script href="http://arcscripts.esri.com/details.asp?dbid=16284" target=_blank&gt;script&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;For the ArcObjects geeks out there, take a look at the code to see what it’s doing. Note, there’s a TerrainBlobReader object used to decode the BLOBs. See also that the multipoint vertex ID’s (automatically assigned during import) are used to map into the BLOB value arrays. For the adventurous, note that ArcObjects also provides a TerrainBlobWriter object. If you have a lot of points that need to be stored as multipoints for the sake of efficiency, but also need per-point attribution, these utility objects come in handy.&lt;/P&gt;
&lt;P&gt;Another potentially useful script converts, or explodes, multipoints for an area of interest (AOI) into points. Its real utility is that it decodes the lidar attributes stored in BLOBs into readable/usable numeric values placed in the output point feature class attribute table. A word of warning: make sure your AOI is not too large. Keep it small enough so it contains fewer than roughly three million points (adjust according to how patient you consider yourself to be). Find &lt;A class="" title="this script" href="http://arcscripts.esri.com/details.asp?dbid=16285" target=_blank&gt;this script&lt;/A&gt; here.&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;Note: Starting with ArcGIS 9.4, the portion of the workflow involving the substitution of intensity for z will not be necessary. The Point to Raster tool will be able to rasterize using the intensity BLOB field directly.&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Rasterize the points&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;Use the Point to Raster tool on the feature class created by the script that swaps intensity with z and set the Value field to Shape (Figure 4). This tells the tool to rasterize using the shape z's which we know are actually intensity. Select MEAN as a rasterization method. The resulting raster is the intensity image. [As a side note: you may find one of the other options is useful for analysis (e.g., using RANGE of intensity as a variable used in feature detection)].&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;A href="http://blogs.esri.com/Dev/photos/geoprocessing/picture5851.aspx" target=_blank&gt;&lt;IMG src="http://blogs.esri.com/Dev/photos/geoprocessing/images/5851/387x379.aspx" border=0&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Before moving on, review the presence of NoData. Significant numbers of NoData cells will result if the output cellsize you specified is too small relative to the density of the lidar points. You can see NoData by assigning a color to it on the Symbology tab of the raster layer Properties dialog. If there’s too much, the easiest thing to do is go back and re-run Point to Raster with a larger cellsize. Alternately, you can use a method described in a previous post to fill in missing values using an expression in the Spatial Analyst calculator (see &lt;A class="" title="Lidar Solutions in ArcGIS_part2" href="http://blogs.esri.com/Dev/blogs/geoprocessing/archive/2008/12/15/Lidar-Solutions-in-ArcGIS_5F00_part2_3A00_-Creating-raster-DEMs-and-DSMs-from-large-lidar-point-collections.aspx" target=_blank&gt;Lidar Solutions in ArcGIS_part2&lt;/A&gt;).&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;Image Display&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;The range of values in the image is hard to predict without knowing details about how your data was collected and processed. For one thing, the original intensity values are sensor dependent. Secondly, the values may have been adjusted by the vendor (e.g., normalized to a range of 0-255). Because of this it’s hard to say what the best display options are. You will need to experiment with the raster layer stretch type and contrast. Turning on bilinear re-sampling is probably a good idea. If you’re looking for more display possibilities consider combining intensity with another variable such as hillshade (Figure 5).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;A href="http://blogs.esri.com/Dev/photos/geoprocessing/picture5852.aspx" target=_blank&gt;&lt;IMG src="http://blogs.esri.com/Dev/photos/geoprocessing/images/5852/582x304.aspx" border=0&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Conclusion&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;The return intensity collected for every lidar point can be used to make images. These images have a variety of uses in GIS applications including feature detection and extraction. ArcGIS provides tools to make these images.&lt;/P&gt;
&lt;P&gt;That concludes this part of Lidar Solutions in ArcGIS. Subscribe to this blog or check back in a month or so for a discussion on how to update terrain datasets with new measurements.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://blogs.esri.com/Dev/aggbug.aspx?PostID=5854" width="1" height="1"&gt;</description><category domain="http://blogs.esri.com/Dev/blogs/geoprocessing/archive/tags/advanced/default.aspx">advanced</category><category domain="http://blogs.esri.com/Dev/blogs/geoprocessing/archive/tags/Tips+and+tricks/default.aspx">Tips and tricks</category><category domain="http://blogs.esri.com/Dev/blogs/geoprocessing/archive/tags/3D+Lidar+Point+Data/default.aspx">3D Lidar Point Data</category></item><item><title>2009 Developers Summit</title><link>http://blogs.esri.com/Dev/blogs/geoprocessing/archive/2009/03/25/2009-Developers-Summit.aspx</link><pubDate>Wed, 25 Mar 2009 23:54:00 GMT</pubDate><guid isPermaLink="false">b60b3f0a-e2bd-4be5-8a18-822c697649ab:4302</guid><dc:creator>dmhoneycutt</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.esri.com/Dev/blogs/geoprocessing/comments/4302.aspx</comments><wfw:commentRss>http://blogs.esri.com/Dev/blogs/geoprocessing/commentrss.aspx?PostID=4302</wfw:commentRss><description>&lt;p&gt;The 2009 Developers Summit has come and gone.&amp;nbsp; Thanks to all who attended!&amp;nbsp; We enjoyed meeting with you.&amp;nbsp; We've uploaded the geoprocessing presentations to the Model and Script tool gallery. Session videos have been posted to the Media Gallery.&amp;nbsp; &lt;br&gt;&lt;/p&gt;&lt;p&gt;Slides, scripts, and data from the two workshops on Designing and Building geoprocessing tools are available in the Model and Script tool gallery, or by clicking &lt;a href="http://resources.esri.com/geoprocessing/index.cfm?fa=codeGalleryDetails&amp;amp;scriptID=16168"&gt;here&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;Slides and other materials from the Building Geoprocessing Services session are available &lt;a href="http://resources.esri.com/geoprocessing/index.cfm?fa=codeGalleryDetails&amp;amp;scriptID=16177"&gt;here&lt;/a&gt;. &lt;/p&gt;&lt;p&gt;Slides and scripts for the Python Scripting Advanced Techniques session are available &lt;a href="http://resources.esri.com/geoprocessing/index.cfm?fa=codeGalleryDetails&amp;amp;scriptID=16184"&gt;here&lt;/a&gt;.&amp;nbsp; &lt;br&gt;&lt;/p&gt;&lt;img src="http://blogs.esri.com/Dev/aggbug.aspx?PostID=4302" width="1" height="1"&gt;</description><category domain="http://blogs.esri.com/Dev/blogs/geoprocessing/archive/tags/advanced/default.aspx">advanced</category><category domain="http://blogs.esri.com/Dev/blogs/geoprocessing/archive/tags/script+tools/default.aspx">script tools</category><category domain="http://blogs.esri.com/Dev/blogs/geoprocessing/archive/tags/Python/default.aspx">Python</category><category domain="http://blogs.esri.com/Dev/blogs/geoprocessing/archive/tags/Digging+deeper/default.aspx">Digging deeper</category><category domain="http://blogs.esri.com/Dev/blogs/geoprocessing/archive/tags/Tips+and+tricks/default.aspx">Tips and tricks</category><category domain="http://blogs.esri.com/Dev/blogs/geoprocessing/archive/tags/2009+Developers+Summit/default.aspx">2009 Developers Summit</category><category domain="http://blogs.esri.com/Dev/blogs/geoprocessing/archive/tags/Geoprocessing+services/default.aspx">Geoprocessing services</category><category domain="http://blogs.esri.com/Dev/blogs/geoprocessing/archive/tags/ArcGIS+Server/default.aspx">ArcGIS Server</category></item><item><title>Send us your feedback</title><link>http://blogs.esri.com/Dev/blogs/geoprocessing/archive/2009/03/25/Send-us-your-feedback.aspx</link><pubDate>Wed, 25 Mar 2009 23:47:00 GMT</pubDate><guid isPermaLink="false">b60b3f0a-e2bd-4be5-8a18-822c697649ab:2779</guid><dc:creator>dmhoneycutt</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.esri.com/Dev/blogs/geoprocessing/comments/2779.aspx</comments><wfw:commentRss>http://blogs.esri.com/Dev/blogs/geoprocessing/commentrss.aspx?PostID=2779</wfw:commentRss><description>&lt;p&gt;You may not have noticed, but you can send us feedback about this site. There's
a feedback link at the bottom right of the home page, as illustrated at the bottom 
of this post.&lt;/p&gt;


&lt;p&gt;We're particularly interested in hearing from you about blog post topics
you'd like to see and suggestions on how we could make this site more useful.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;a href="http://blogs.esri.com/Dev/photos/geoprocessing/picture2780.aspx" target="_blank"&gt;&lt;img src="http://blogs.esri.com/Dev/photos/geoprocessing/images/2780/408x480.aspx" border="0"&gt;&lt;/a&gt;&amp;nbsp;&lt;/p&gt;&lt;img src="http://blogs.esri.com/Dev/aggbug.aspx?PostID=2779" width="1" height="1"&gt;</description><category domain="http://blogs.esri.com/Dev/blogs/geoprocessing/archive/tags/beginner/default.aspx">beginner</category><category domain="http://blogs.esri.com/Dev/blogs/geoprocessing/archive/tags/advanced/default.aspx">advanced</category><category domain="http://blogs.esri.com/Dev/blogs/geoprocessing/archive/tags/New+at+9.3/default.aspx">New at 9.3</category><category domain="http://blogs.esri.com/Dev/blogs/geoprocessing/archive/tags/Spatial+Analysis/default.aspx">Spatial Analysis</category><category domain="http://blogs.esri.com/Dev/blogs/geoprocessing/archive/tags/script+tools/default.aspx">script tools</category><category domain="http://blogs.esri.com/Dev/blogs/geoprocessing/archive/tags/Python/default.aspx">Python</category><category domain="http://blogs.esri.com/Dev/blogs/geoprocessing/archive/tags/ArcSDE/default.aspx">ArcSDE</category><category domain="http://blogs.esri.com/Dev/blogs/geoprocessing/archive/tags/Geostatistical+Analyst/default.aspx">Geostatistical Analyst</category><category domain="http://blogs.esri.com/Dev/blogs/geoprocessing/archive/tags/Digging+deeper/default.aspx">Digging deeper</category><category domain="http://blogs.esri.com/Dev/blogs/geoprocessing/archive/tags/Tips+and+tricks/default.aspx">Tips and tricks</category><category domain="http://blogs.esri.com/Dev/blogs/geoprocessing/archive/tags/UNIX_2F00_Linux/default.aspx">UNIX/Linux</category><category domain="http://blogs.esri.com/Dev/blogs/geoprocessing/archive/tags/3D+Lidar+Point+Data/default.aspx">3D Lidar Point Data</category><category domain="http://blogs.esri.com/Dev/blogs/geoprocessing/archive/tags/ModelBuilder/default.aspx">ModelBuilder</category><category domain="http://blogs.esri.com/Dev/blogs/geoprocessing/archive/tags/2009+Developers+Summit/default.aspx">2009 Developers Summit</category></item><item><title>Tips and tricks - accessing feature shape in Calculate Field</title><link>http://blogs.esri.com/Dev/blogs/geoprocessing/archive/2009/03/06/Tips-and-tricks-_2D00_-accessing-feature-shape-in-Calculate-Field.aspx</link><pubDate>Fri, 06 Mar 2009 23:44:00 GMT</pubDate><guid isPermaLink="false">b60b3f0a-e2bd-4be5-8a18-822c697649ab:3997</guid><dc:creator>dmhoneycutt</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.esri.com/Dev/blogs/geoprocessing/comments/3997.aspx</comments><wfw:commentRss>http://blogs.esri.com/Dev/blogs/geoprocessing/commentrss.aspx?PostID=3997</wfw:commentRss><description>&lt;p&gt;With the &lt;a href="http://webhelp.esri.com/arcgisdesktop/9.3/index.cfm?id=1737&amp;amp;pid=1733&amp;amp;topicname=Calculate_Field_%28Data_Management%29" target="_blank"&gt;Calculate Field tool&lt;/a&gt;, you can easily create expressions that use 
some property of a feature's shape, such as length or area.  You can also convert 
length and area to different units.  The illustration below shows calculating 
the MILES field to the length (in miles) of each line feature.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.esri.com/Dev/photos/geoprocessing/picture3998.aspx" target="_blank"&gt;&lt;img src="http://blogs.esri.com/Dev/photos/geoprocessing/images/3998/381x447.aspx" border="0"&gt;&lt;/a&gt;&amp;nbsp;&lt;/p&gt;

&lt;h5&gt;Details about the Expression syntax&lt;/h5&gt;

&lt;p&gt;The expression syntax -- 
&lt;font face="courier new, courier, mono"&gt;!shape.length@miles!&lt;/font&gt; -- 
starts and ends with the special 'decode field' character.  
This decode field character is different 
depending on the value of the Expression Type parameter.  For Expression Type 
of PYTHON or PYTHON_9.3, the character is an exclamation point ("!"), as shown 
in the illustration above.  For VB, the decode field characters 
are "[" and "]".&lt;/p&gt;

&lt;p&gt;Inside the decode field characters, you can put the name of any field 
found on the input table.  You can also use the reserved field name "&lt;font face="courier new, courier, mono"&gt;shape&lt;/font&gt;" 
followed by a period and an attribute of the shape.  In this case, we're 
using the length attribute:  &lt;font face="courier new, courier, mono"&gt;!shape.length!&lt;/font&gt;  &lt;/p&gt;

&lt;p&gt;Finally, we convert shape.length to miles with the use of the special 
unit conversion syntax '&lt;font face="courier new, courier, mono"&gt;@&amp;lt;unit&amp;gt;&lt;/font&gt;'.  
 Unit can be any of the following: 
CENTIMETERS | DECIMALDEGREES | DECIMETERS | FEET | INCHES | KILOMETERS | 
METERS | MILES | MILLIMETERS | NAUTICALMILES | POINTS | YARDS.  &lt;/p&gt;

&lt;p&gt;If your shape type is polygon, you can use these areal unit keywords:  
ACRES | ARES | HECTARES | SQUARECENTIMETERS | SQUAREDECIMETERS | SQUAREINCHES | 
SQUAREFEET | SQUAREKILOMETERS | SQUAREMETERS | SQUAREMILES | SQUAREMILLIMETERS | 
SQUAREYARDS&lt;/p&gt;

&lt;h5&gt;More things you can do with the shape object and its attributes&lt;/h5&gt;

&lt;p&gt;The shape field is actually a &lt;a href="http://webhelp.esri.com/arcgisdesktop/9.3/index.cfm?TopicName=The%20geometry%20object" target="_blank"&gt;geometry object&lt;/a&gt; with the following properties.  &lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.esri.com/Dev/photos/geoprocessing/images/3999/original.aspx" target="_blank"&gt;&lt;img src="http://blogs.esri.com/Dev/photos/geoprocessing/images/3999/215x271.aspx" border="0"&gt;&lt;/a&gt;&amp;nbsp;&lt;/p&gt;


&lt;p&gt;If, for example, you wanted the X-coordinate of the first point of a line, 
you would use &lt;font face="courier new, courier, mono"&gt;!shape.firstpoint.x!&lt;/font&gt;  
To find the minimum X-coordinate of the line, 
use &lt;font face="courier new, courier, mono"&gt;!shape.extent.xmin!&lt;/font&gt;&lt;/p&gt;

&lt;h5&gt;Simple equations&lt;/h5&gt;
&lt;p&gt;The expression can contain simple equations.  For example, to calculate  
 minutes it would take to traverse a street segment going 30 miles per hour, 
 use:&lt;/p&gt;
 
&lt;p&gt;&lt;font face="courier new, courier, mono"&gt;!shape.length@miles! / (30.0 / 60.0)&lt;/font&gt;&lt;/p&gt;
   
 
&lt;p&gt;&amp;nbsp;Note that:
 &lt;/p&gt;

&lt;p&gt;&lt;font face="courier new, courier, mono"&gt;!shape.length@miles! / (30 / 60)&lt;/font&gt; &lt;/p&gt;
 
&lt;p&gt;won't work - when doing real arithmetic you need the decimal point after 30 and 60.&lt;/p&gt;
&lt;h5&gt;Code blocks&lt;/h5&gt;
&lt;p&gt;See &lt;a href="http://www.esri.com/news/arcuser/0507/files/pythonscript.pdf" target="_blank"&gt;http://www.esri.com/news/arcuser/0507/files/pythonscript.pdf&lt;/a&gt; for information on using code blocks in Calculate Field&lt;br&gt;&lt;/p&gt;&lt;img src="http://blogs.esri.com/Dev/aggbug.aspx?PostID=3997" width="1" height="1"&gt;</description><category domain="http://blogs.esri.com/Dev/blogs/geoprocessing/archive/tags/beginner/default.aspx">beginner</category><category domain="http://blogs.esri.com/Dev/blogs/geoprocessing/archive/tags/advanced/default.aspx">advanced</category><category domain="http://blogs.esri.com/Dev/blogs/geoprocessing/archive/tags/Python/default.aspx">Python</category><category domain="http://blogs.esri.com/Dev/blogs/geoprocessing/archive/tags/Tips+and+tricks/default.aspx">Tips and tricks</category></item><item><title>ModelBuilder posting at the Mapping Center</title><link>http://blogs.esri.com/Dev/blogs/geoprocessing/archive/2009/03/05/ModelBuilder-posting-at-the-Mapping-Center.aspx</link><pubDate>Fri, 06 Mar 2009 00:57:00 GMT</pubDate><guid isPermaLink="false">b60b3f0a-e2bd-4be5-8a18-822c697649ab:3977</guid><dc:creator>dmhoneycutt</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.esri.com/Dev/blogs/geoprocessing/comments/3977.aspx</comments><wfw:commentRss>http://blogs.esri.com/Dev/blogs/geoprocessing/commentrss.aspx?PostID=3977</wfw:commentRss><description>&lt;p&gt;Here's a great post on the mapping center about ModelBuilder:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.esri.com/Support/blogs/mappingcenter/archive/2009/02/19/10-things-I-wish-I-had-known-about-ModelBuilder-before-I-started-using-it.aspx#1092" title="What I wish I had known about ModelBuilder before I started using it"&gt;What I wish I had known about ModelBuilder before I started using it&lt;/a&gt;&lt;/p&gt;&lt;img src="http://blogs.esri.com/Dev/aggbug.aspx?PostID=3977" width="1" height="1"&gt;</description><category domain="http://blogs.esri.com/Dev/blogs/geoprocessing/archive/tags/beginner/default.aspx">beginner</category><category domain="http://blogs.esri.com/Dev/blogs/geoprocessing/archive/tags/advanced/default.aspx">advanced</category><category domain="http://blogs.esri.com/Dev/blogs/geoprocessing/archive/tags/Tips+and+tricks/default.aspx">Tips and tricks</category><category domain="http://blogs.esri.com/Dev/blogs/geoprocessing/archive/tags/ModelBuilder/default.aspx">ModelBuilder</category></item><item><title>Tips and tricks - Unix, Python, and Geoprocessing</title><link>http://blogs.esri.com/Dev/blogs/geoprocessing/archive/2008/10/27/Tips-and-tricks-_2D00_-Unix_2C00_-Python_2C00_-and-Geoprocessing.aspx</link><pubDate>Mon, 27 Oct 2008 22:41:00 GMT</pubDate><guid isPermaLink="false">b60b3f0a-e2bd-4be5-8a18-822c697649ab:2865</guid><dc:creator>dmhoneycutt</dc:creator><slash:comments>4</slash:comments><comments>http://blogs.esri.com/Dev/blogs/geoprocessing/comments/2865.aspx</comments><wfw:commentRss>http://blogs.esri.com/Dev/blogs/geoprocessing/commentrss.aspx?PostID=2865</wfw:commentRss><description>&lt;p&gt;&lt;i&gt;This posting was written by Mark Zollinger, a Product Engineer and long time 
UNIX user with the Geoprocessing team.&lt;/i&gt;
&lt;/p&gt;


&lt;p&gt;Do you like Solaris or Linux?  Do you "do GIS" on one of those platforms? 
Maybe you've been asked to convert some ArcGIS Workstation AML applications 
over to ArcGIS Engine.  Are you a command-line junkie?  (There are more of us 
than you might think)&lt;/p&gt;

&lt;p&gt;If, for one of the above or any other reason, you find yourself wondering 
if you should try developing GIS on Solaris or Linux, then it's time to stop 
wondering.  Join in with others who include a flavor of *nix in their list of 
working development platforms.&lt;/p&gt;

&lt;p&gt;There are several approaches to GIS development that work very well on 
Solaris and Linux.  &lt;/p&gt;

&lt;p&gt;If you are into low-level programming, you should consider Java or C++, 
both of which can access ArcGIS's ArcObjects API.  
I've used Java quite a bit over the years, and can tell you that the doors 
are wide open on what you can do with it. If this sound like the thing for you, 
then you can move along now, there's nothing to see here.  
This post isn't about ArcObjects at all.&lt;/p&gt;

&lt;p&gt;If you lean towards scripting and higher level abstractions, then geoprocessing's 
more coarse-grained object model, then you are in the right place.  
The rest of this post will show you how to set up an IDE for Python 
development and write a very simple geoprocessing script.&lt;/p&gt;

&lt;p&gt;I mentioned a moment ago that I've written my share of Java ArcObjects code.  
I've got to confess though, that I've always been a fan of scripting languages.  
Python and GP is where I spend most of my time these days.&lt;/p&gt;

&lt;h4&gt;Setting up&lt;/h4&gt;
&lt;p&gt;"Okay", you ask, "How do I start writing GP code in Python on non-Windows platforms?"&lt;/p&gt;

&lt;p&gt;You can do Python and GP from the command line, and I often prefer the focus this brings.  
I've found, however, that most folks prefer to work in a graphic 
IDE (Integrated Development Environment).&lt;/p&gt;

&lt;h5&gt;Setting up an IDE that you can use&lt;/h5&gt;
&lt;p&gt;Probably your best choice is the Eclipse IDE with the Pydev plugin.  
Eclipse is an Open Source IDE, intended to work with a wide variety of programming languages.  
Pydev is the plugin that specifically enables Python development in Eclipse.  &lt;/p&gt;


&lt;p&gt;The latest version of Eclipse, named Ganymede, has not been fully tested by ESRI for use with ArcGIS 9.3, and is not available for some older UNIX releases.  We recommend using version 3.3.2, which you can find in the archive at:&lt;/p&gt;

&lt;a href="http://archive.eclipse.org/eclipse/downloads/" target="_blank"&gt;http://archive.eclipse.org/eclipse/downloads/&lt;/a&gt;

&lt;p&gt;To install Eclipse, 
follow the instructions in the "Installing Eclipse" paragraph at:&lt;/p&gt;

&lt;a href="http://wiki.eclipse.org/FAQ_Where_do_I_get_and_install_Eclipse%3F" target="_blank"&gt;http://wiki.eclipse.org/FAQ_Where_do_I_get_and_install_Eclipse%3F&lt;/a&gt;

&lt;p&gt;(These instructions are for Ganymede, but they basically the same for version 3.3.2)&lt;/p&gt;

&lt;p&gt;Once you have Eclipse installed and running, you need to add the Pydev plugin.  
Just follow the "Getting Started" link on the left side of the Pydev homepage.&lt;/p&gt;
&lt;a href="http://pydev.sourceforge.net/" target="_blank"&gt;http://pydev.sourceforge.net/&lt;/a&gt;

&lt;p&gt;Note that you need the Open Source Pydev plugin.  The Pydev Extensions 
plugin is commercial trialware, and is optional.&lt;/p&gt;

&lt;p&gt;When you get to the "Configuring the interpreter" page, you are told to choose 
the Python interpreter that Pydev should use to run Python programs.  Use the 
Python installation you use for Engine development/testing. In most cases, this 
is the one that got installed with the Engine Runtime:&lt;/p&gt;

&lt;font size="2" face="courier new, courier, mono"&gt;$ARCGISHOME/python25/bin/python&lt;/font&gt;&lt;br&gt;

&lt;p&gt;Note: you might get an error message while trying to choose the interpreter.  
If you do, click the error dialog's Details button.  The message probably includes something like this:&lt;/p&gt;
&lt;font size="2" face="courier new, courier, mono"&gt;ld.so.1: python: fatal: libpython2.5.so.1.0: open failed: No such file or directory&lt;/font&gt;&lt;br&gt;

&lt;p&gt;This is an indication that the python interpreter is not correctly set up.  
The most likely cause is that your ArcGIS Engine environment has not yet been established.  
Exit Eclipse and source the init_engine shell script that applies to the shell 
you are using.  When you start Eclipse the problem should go away.
&lt;/p&gt;

&lt;p&gt;Also, item 3 on the "Configuring the interpreter" page asks you to set the 
SYSTEM PYTHONPATH.  When you do this, make sure to include $ARCGISHOME/bin.  
This matches the PYTHONPATH that gets set when you source init_engine.&lt;/p&gt;

&lt;h4&gt;Writing a Python script that does GP stuff&lt;/h4&gt;

&lt;p&gt;Now that you have a development environment, how do you use all this great 
GP stuff?  Let's create a very simple Python script to get you started on the 
road to GP development.  In most Python scripts, the first thing to do is to 
import the modules that you will need.  
For GP, we need to import the arcgisscripting module.  Let's also import the 
os and system modules:
&lt;/p&gt;
&lt;font size="2" face="courier new, courier, mono"&gt;import arcgisscripting&lt;br&gt;
import os, sys&lt;br&gt;&lt;/font&gt;

&lt;p&gt;To access GP, we need to create a Geoprocessor object.  This is the object 
through which you will call any GP functions or objects&lt;/p&gt;

&lt;font size="2" face="courier new, courier, mono"&gt;
gp = arcgisscripting.create(9.3)&lt;/font&gt;

&lt;p&gt;By passing in the 9.3 argument, you are getting the newer version of the 
Geoprocessor object, which is a little more Python friendly.  For this example 
we won't be using any of the Python friendly features, but it is never too early 
to start a good habit.&lt;/p&gt;

&lt;p&gt;Now that you have a GP object, what do you do with it? Let's set GP's workspace 
property and print it out, just to prove to ourselves that it really worked.  
For this example, let's set the workspace to a "data" directory just underneath 
the current Python directory.&lt;/p&gt;

&lt;font size="2" face="courier new, courier, mono"&gt;gp.workspace = os.path.join (sys.path[0], "data")&lt;br&gt;print "GP Workspace = " + gp.workspace&lt;br&gt;&lt;/font&gt;

&lt;p&gt;(Of course you can set
the workspace to any accessible directory, not just the one returned 
by &lt;font size="2" face="courier new, courier, mono"&gt;sys.path[0]&lt;/font&gt;.  I'm just using
&lt;font size="2" face="courier new, courier, mono"&gt;sys.path[0]&lt;/font&gt; because I know it's accessible.)&lt;/p&gt;

&lt;p&gt;sys.path is a list of strings where Python looks for modules.  The first item 
in the list is the current Python directory.  Calling os.path.join is a great 
way to build up filesystem paths, since it correctly handles all the path separator issues.  
(More on path separators later.)
When you run this script (Run -&amp;gt; Run As -&amp;gt; Python Run), you should see "GP Workspace= /some/path/data" 
printed in the Console tab near the bottom of the Eclipse window.  
&lt;/p&gt;

&lt;p&gt;You can use Eclipse or the operating system to create the data directory, 
since it probably doesn't exist yet.&lt;/p&gt;

&lt;p&gt;For this example, let's suppose you have point data representing hawk sitings 
in a national forest.  Your study area is a subset of the forest where a particular 
plant in known to grow.  What you need to do is clip your point data using the 
polygon of your study area.&lt;/p&gt;

&lt;p&gt;Once you have copied your data into the aforementioned data directory, 
your script could execute the clip tool like this:&lt;/p&gt;

&lt;font size="2" face="courier new, courier, mono"&gt;
&lt;pre&gt;gp.clip_analysis("nat_for.gdb/hawk_sightings", "study_area.shp", "nat_for.gdb/study_sightings")&lt;/pre&gt;&lt;/font&gt;

&lt;p&gt;Just to be sure it worked, you can print out the messages that the tool generated like this:&lt;/p&gt;

&lt;font size="2" face="courier new, courier, mono"&gt;
print (gp.getmessages())&lt;/font&gt;

&lt;p&gt;Notice that in calling the clip tool, we used forward slashes (/).  Back slashes (\) 
and forward slashes work equally well in ArcGIS on ALL platforms, so you don't 
need to worry about switching back and forth when you change to Windows.  You can 
even use back slashes on Linux and Solaris. The problem is that in Python, back 
slashes are a special character, so to use them, you have to treat them differently 
than most other characters.&lt;/p&gt;

&lt;ol&gt;- You can escape them: "\\some\\path"&lt;br&gt;
- You can use raw strings: r"\some\path"&lt;br&gt;
- You can use unicode strings: u"\some\path"&lt;br&gt;
&lt;/ol&gt;

&lt;p&gt;If you stick to forward slashes on all platforms, you improve the look of your code 
and reduce the effort it takes to type it.&lt;/p&gt;

&lt;p&gt;So now you have a script that looks like this:&lt;/p&gt;


&lt;blockquote&gt;&lt;font size="2" face="courier new, courier, mono"&gt;
import arcgisscripting&lt;br&gt;import os, sys&lt;br&gt;&lt;br&gt;gp = arcgisscripting.create(9.3)&lt;br&gt;&lt;br&gt;gp.workspace = os.path.join (sys.path[0], "data")&lt;br&gt;print "GP Workspace = " + gp.workspace&lt;br&gt;&lt;br&gt;gp.clip_analysis("nat_for.gdb/hawk_sightings", "study_area.shp", "nat_for.gdb/study_sightings")&lt;br&gt;print (gp.getmessages())&lt;/font&gt;&lt;/blockquote&gt;

&lt;p&gt;Run it, and it works, creating a new featureclass in the file geodatabase.
Now wasn't that easy?
To get more complicated, you just string together as many of those tools as you need to get the job done.  
&lt;/p&gt;

&lt;p&gt;Welcome to the world of Geoprocessing with Python!&lt;/p&gt;

&lt;h4&gt;Links&lt;/h4&gt;
&lt;a href="http://webhelp.esri.com/arcgisdesktop/9.3/index.cfm?TopicName=An_overview_of_writing_geoprocessing_scripts"&gt;Automating workflows with scripts&lt;/a&gt; - Introduction to writing Python scripts for geoprocessing&lt;br&gt;
&lt;a href="http://webhelp.esri.com/arcgisdesktop/9.3/index.cfm?TopicName=Techniques_for_sharing_Python_scripts"&gt;Techniques for sharing Python scripts&lt;/a&gt; - Useful techniques for sharing Python scripts&lt;br&gt;
&lt;a href="http://docs.python.org/tutorial/"&gt;The Python Tutorial&lt;/a&gt; - If you're new to Python, this is a good tutorial to start&lt;br&gt;
&lt;a href="http://webhelp.esri.com/arcgisdesktop/9.3/index.cfm?TopicName=Python_equivalents_to_AML_functions"&gt;How to duplicate AML functions in Python&lt;/a&gt; - For AML programmers&lt;br&gt;
&lt;a href="http://webhelp.esri.com/arcgisdesktop/9.3/index.cfm?TopicName=Python_equivalents_to_AML_directives"&gt;How to duplicate AML directives in Python&lt;/a&gt;- For AML programmers&lt;br&gt;

&lt;h4&gt;Troubleshooting&lt;/h4&gt;
&lt;h5&gt;Color issues&lt;/h5&gt;
&lt;p&gt;Upon using Eclipse on Solaris for the first time, you may see some color problems. 
For example, the text insertion caret might be white on a white background, making it invisible.
Another common symptom is that you cannot see the outline of text input fields.
If you run into this or something similar, check the color depth of your display.
If it is set to 8 bits, change it to 24.
&lt;/p&gt;

&lt;h5&gt;init_engine&lt;/h5&gt;
&lt;p&gt;You should have your Engine environment already established in the shell in 
which you start Eclipse. (&lt;font size="2" face="courier new, courier, mono"&gt;source init_engine.sh&lt;/font&gt; 
or &lt;font size="2" face="courier new, courier, mono"&gt;source init_engine.csh&lt;/font&gt;)
  If you see inexplicable error messages, this is the most likely cause.&lt;/p&gt;&lt;img src="http://blogs.esri.com/Dev/aggbug.aspx?PostID=2865" width="1" height="1"&gt;</description><category domain="http://blogs.esri.com/Dev/blogs/geoprocessing/archive/tags/beginner/default.aspx">beginner</category><category domain="http://blogs.esri.com/Dev/blogs/geoprocessing/archive/tags/advanced/default.aspx">advanced</category><category domain="http://blogs.esri.com/Dev/blogs/geoprocessing/archive/tags/Python/default.aspx">Python</category><category domain="http://blogs.esri.com/Dev/blogs/geoprocessing/archive/tags/Tips+and+tricks/default.aspx">Tips and tricks</category><category domain="http://blogs.esri.com/Dev/blogs/geoprocessing/archive/tags/UNIX_2F00_Linux/default.aspx">UNIX/Linux</category></item><item><title>Tips and Tricks - Creating ArcSDE connection files on the fly using Python and ArcObjects</title><link>http://blogs.esri.com/Dev/blogs/geoprocessing/archive/2008/09/24/Tips-and-Tricks-_2D00_-Creating-ArcSDE-connection-files-on-the-fly-using-Python-and-ArcObjects.aspx</link><pubDate>Wed, 24 Sep 2008 22:57:00 GMT</pubDate><guid isPermaLink="false">b60b3f0a-e2bd-4be5-8a18-822c697649ab:2620</guid><dc:creator>dmhoneycutt</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.esri.com/Dev/blogs/geoprocessing/comments/2620.aspx</comments><wfw:commentRss>http://blogs.esri.com/Dev/blogs/geoprocessing/commentrss.aspx?PostID=2620</wfw:commentRss><description>&lt;p&gt;ArcGIS 9.3 does not provide a geoprocessing tool for creating ArcSDE 
connection files (.sde files).   Some of you have requested such a tool for security 
reasons - typically because you do not want .sde connection files hanging 
around on machines.  Rather, you want to automatically create a connection file 
in a temporary location, use it in your script or model, and then delete it 
within the process you are running.  Others need the ability to create .sde files 
on the fly because the connection properties, such as what version to connect to, 
are not known at the start of the process.  Having to stop the process for someone 
to manually create the .sde file with the correct properties really isn't an 
option anyone wants to entertain.&lt;/p&gt;

&lt;p&gt;The attached .zip file (&lt;a href="http://resources.esri.com/help/9.3/geoprocessing/zip/SDE_ConnectionFiles.zip"&gt;download .zip file&lt;/a&gt;) contains a java class (CreateSDEConnFile) and a 
python script (CreateSDEConnFile.py) to create
ArcSDE connection files on the fly.  Download and unzip the file.  Be sure to 
unzip the file into a folder that does not contain spaces.  For example:&lt;/p&gt;

&lt;blockquote&gt;
&lt;font size="2" face="courier new, courier, mono"&gt;E:\SDE Conn sample (incorrect - contains spaces)&lt;/font&gt;&lt;br&gt;
&lt;font size="2" face="courier new, courier, mono"&gt;E:\SDEConnectionSample (correct - no spaces)&lt;/font&gt;&lt;br&gt;
&lt;/blockquote&gt;

&lt;h4&gt;Java must be installed&lt;/h4&gt;
&lt;p&gt;You must have Java installed in order to use the files included in the .zip file.  
Most likely, Java is installed on your machine -- it gets installed by many websites.
You can check by examining your installed programs list.  You can install java by
visiting &lt;a href="http://java.com/en/" target="_blank"&gt;java.com&lt;/a&gt;.
&lt;/p&gt;

&lt;h4&gt;Setting JAVA_HOME&lt;/h4&gt;
&lt;p&gt;In order for CreateSDEConnFile.py file to execute, you must have the JAVA_HOME
system environment variable set to the location of the java install directory.&lt;/p&gt;

&lt;p&gt;On Windows XP, right-click "My Computer" on your desktop, click the Advanced tab, and click the
"Environment Variables" button.  If the JAVA_HOME environment variable doesn't exist,
create it by clicking the "New" button.  
(On my machine, &lt;font size="2" face="courier new, courier, mono"&gt;JAVA_HOME = C:\Program Files\Java\jre1.6.0_07&lt;/font&gt;)&lt;/p&gt;

&lt;h4&gt;About CreateSDEConnFile.py Python script&lt;/h4&gt;
&lt;p&gt;
CreateSDEConnFile.py is a sample script.  
You will need to modify it to include details about your ArcSDE configuration and security needs.
There is no associated geoprocessing script tool for CreateSDEConnFile.py -- you will have to
create your own script tool for use in ModelBuilder (See &lt;a href="http://webhelp.esri.com/arcgisdesktop/9.3/index.cfm?TopicName=An_overview_of_creating_script_tools"&gt;An overview of creating script tools&lt;/a&gt; in the web help for
more information about creating script tools.)
&lt;/p&gt;

&lt;h4&gt;Arguments to the CreateSDEConnFile java class&lt;/h4&gt;
&lt;font size="2" face="courier new, courier, mono"&gt;String sConFileDir = args[0]; //Folder path to store the .sde file.&lt;/font&gt;&lt;br&gt;
&lt;font size="2" face="courier new, courier, mono"&gt;String sConFile = args[1]; //.sde file name. include the .sde extension.&lt;/font&gt;&lt;br&gt;
&lt;font size="2" face="courier new, courier, mono"&gt;pConnProps.setProperty("SERVER", args[2]); //ArcSDE Server name.&lt;/font&gt;&lt;br&gt;
&lt;font size="2" face="courier new, courier, mono"&gt;pConnProps.setProperty("INSTANCE", args[3]); //ArcSDE port number.&lt;/font&gt;&lt;br&gt;
&lt;font size="2" face="courier new, courier, mono"&gt;pConnProps.setProperty("USER", args[4]); //ArcSDE user name.&lt;/font&gt;&lt;br&gt;
&lt;font size="2" face="courier new, courier, mono"&gt;pConnProps.setProperty("PASSWORD", args[5]); //ArcSDE password.&lt;/font&gt;&lt;br&gt;
&lt;font size="2" face="courier new, courier, mono"&gt;pConnProps.setProperty("VERSION", args[6]); //Version to connect to.&lt;/font&gt;&lt;br&gt;
&lt;font size="2" face="courier new, courier, mono"&gt;pConnProps.setProperty("DATABASE", args[7]); //Database to connect to.&lt;/font&gt;&lt;br&gt;
&lt;br&gt;

&lt;h4&gt;zip file&lt;/h4&gt;
&lt;p&gt;&lt;a href="http://resources.esri.com/help/9.3/geoprocessing/zip/SDE_ConnectionFiles.zip"&gt;Download zip file&lt;/a&gt;&lt;/p&gt;&lt;img src="http://blogs.esri.com/Dev/aggbug.aspx?PostID=2620" width="1" height="1"&gt;</description><category domain="http://blogs.esri.com/Dev/blogs/geoprocessing/archive/tags/advanced/default.aspx">advanced</category><category domain="http://blogs.esri.com/Dev/blogs/geoprocessing/archive/tags/ArcSDE/default.aspx">ArcSDE</category><category domain="http://blogs.esri.com/Dev/blogs/geoprocessing/archive/tags/Tips+and+tricks/default.aspx">Tips and tricks</category></item><item><title>Watch ESRI TV</title><link>http://blogs.esri.com/Dev/blogs/geoprocessing/archive/2008/09/09/Watch-ESRI-TV.aspx</link><pubDate>Tue, 09 Sep 2008 17:17:00 GMT</pubDate><guid isPermaLink="false">b60b3f0a-e2bd-4be5-8a18-822c697649ab:2627</guid><dc:creator>dmhoneycutt</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.esri.com/Dev/blogs/geoprocessing/comments/2627.aspx</comments><wfw:commentRss>http://blogs.esri.com/Dev/blogs/geoprocessing/commentrss.aspx?PostID=2627</wfw:commentRss><description>Check out &lt;a href="http://www.youtube.com/esritv" target="_blank"&gt;http://www.youtube.com/esritv&lt;/a&gt;.&amp;nbsp; It contains over 50 videos on a variety of ArcGIS subjects.&amp;nbsp; Content is updated periodically.&amp;nbsp; You can also access the videos on Viddler:&lt;a href="http://www.viddler.com/explore/esri" target="_blank"&gt; http://www.viddler.com/explore/esri&lt;/a&gt;&lt;br&gt;&lt;img src="http://blogs.esri.com/Dev/aggbug.aspx?PostID=2627" width="1" height="1"&gt;</description><category domain="http://blogs.esri.com/Dev/blogs/geoprocessing/archive/tags/beginner/default.aspx">beginner</category><category domain="http://blogs.esri.com/Dev/blogs/geoprocessing/archive/tags/advanced/default.aspx">advanced</category><category domain="http://blogs.esri.com/Dev/blogs/geoprocessing/archive/tags/New+at+9.3/default.aspx">New at 9.3</category></item><item><title>Digging deeper - Troubleshooting geoprocessing errors when using ArcSDE data</title><link>http://blogs.esri.com/Dev/blogs/geoprocessing/archive/2008/09/05/Digging-deeper-_2D00_-Troubleshooting-geoprocessing-errors-when-using-ArcSDE-data.aspx</link><pubDate>Fri, 05 Sep 2008 23:13:00 GMT</pubDate><guid isPermaLink="false">b60b3f0a-e2bd-4be5-8a18-822c697649ab:2601</guid><dc:creator>dmhoneycutt</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.esri.com/Dev/blogs/geoprocessing/comments/2601.aspx</comments><wfw:commentRss>http://blogs.esri.com/Dev/blogs/geoprocessing/commentrss.aspx?PostID=2601</wfw:commentRss><description>&lt;p&gt;Geoprocessing error reporting has significantly improved in the ArcGIS 9.3 release.  
All tractable errors now have a unique error code and each error code has 
a detailed explanation in the help system.  See&lt;a href="http://webhelpdev.esri.com/arcgisdesktop/9.3/index.cfm?TopicName=Understanding_geoprocessing_tool_errors_and_warnings"&gt; Understanding geoprocessing tool errors and warnings&lt;/a&gt; for more details.
&lt;/p&gt;


&lt;p&gt;However, at this time, geoprocessing errors that occur when reading or writing 
ArcSDE/DBMS data receive a generic 'catch-all' error message, such as error 00210 when writing output:&lt;/p&gt;

&lt;p&gt;&lt;font face="courier new, courier, mono"&gt;ERROR 000210: Cannot create output E:\Infra\ToolData\Connection to ArcSDE.sde\ken.cities&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;  We are working 
hard to improve reporting of ArcSDE/DBMS geoprocessing errors in future service 
packs and releases.  In the meantime, here are some techniques you can use to 
determine the cause of your error.&amp;nbsp; Note that the cause of the error could be anything from not being able to connect 
to ArcSDE to any number of DBMS or network related issues.&lt;/p&gt;

&lt;h3&gt;Test the connection&lt;/h3&gt;

&lt;p&gt;The first thing you should test is whether your ArcSDE/DBMS connection properties 
are correct.  Open ArcCatalog and navigate to the location containing the .sde 
connection file ("E:\Infra\ToolData" in the above example) and double-click the 
connection, causing a connection to be made to the database.  If a connection cannot be made, you'll receive an error message with details on the cause. If you can make a connection, then your connection properties may be invalid.&amp;nbsp; Right-click the connection and select Connection 
Properties.&amp;nbsp; Visually inspect the connection properties.  Make sure that your 
script or model is using the correct user name when fully qualifying object names. For example, you may have connected to the database as the user 'ken' in the 
connection file, but the data paths in the script or model has a different user 
for the qualified feature class name, as illustrated below. &lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.esri.com/Dev/photos/geoprocessing/picture2608.aspx" target="_blank"&gt;&lt;img src="http://blogs.esri.com/Dev/photos/geoprocessing/images/2608/640x320.aspx" border="0"&gt;&lt;/a&gt;&amp;nbsp;&lt;/p&gt;

&lt;p&gt;
If everything seems correct with your connection file, the next investigation step is to set up a client-side SDEINTERCEPT.&lt;/p&gt;
&lt;h3&gt;Client-side SDEINTERCEPT&lt;/h3&gt;
&lt;p&gt;You may need to dig 
deeper by instructing ArcGIS to log information about the communication between 
your computer and the ArcSDE server.  To instruct ArcGIS to log information, and where 
to write the logs, you need to set certain system environment variables.  
The exact technique for setting these variables depends on whether you are 
using Windows or UNIX.  For a full explanation of the variables and how to set 
them, see the web help topic &lt;a href="http://webhelpdev.esri.com/arcgisdesktop/9.3/index.cfm?topicname=the_dbinit.sde_file"&gt;The dbinit.sde file&lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;(For a more general introduction to configuring ArcSDE geodatabases, see &lt;a href="http://webhelpdev.esri.com/arcgisdesktop/9.3/index.cfm?TopicName=An_overview_of_configuring_an_ArcSDE_geodatabase"&gt;An Overview of configuring an ArcSDE geodatabase&lt;/a&gt; .)
&lt;/p&gt;
A SDEINTERCEPT file contains all the calls to ArcSDE along with their return values.  
These return values often contain the failure message received from ArcSDE or the error message ArcSDE received from the database.  On Windows, the general 
steps are:

&lt;p&gt;&lt;b&gt;1. Set the following system environment variables:&lt;/b&gt;&lt;/p&gt;


&lt;ul&gt;SDEINTERCEPT=crwft&lt;br&gt;
SDEINTERCEPTLOC=&amp;lt;folder name&amp;gt;&lt;/ul&gt;

&lt;p&gt;&amp;lt;folder name&amp;gt; can be any existing folder on your computer.  
Just be sure to add the slash at the end of the pathname (i.e.: C:\temp\logs\)&lt;/p&gt;


&lt;p&gt;On Windows XP, system environment variables are accessed by right-clicking 
My Computer and clicking Properties.  On the Advanced Tab, click Environment 
Variables, as illustrated below.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.esri.com/Dev/photos/geoprocessing/picture2609.aspx" target="_blank"&gt;&lt;img src="http://blogs.esri.com/Dev/photos/geoprocessing/images/2609/640x383.aspx" border="0"&gt;&lt;/a&gt;&amp;nbsp;&lt;/p&gt;


&lt;p&gt;&lt;b&gt;2. Restart the application that will run the geoprocessing tool 
(such as ArcMap) so that it inherits the new system environment. &lt;/b&gt;&lt;/p&gt;

&lt;p&gt;&lt;b&gt;3. Run the geoprocessing tool or script that caused the failure.&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;After the task is run, a file named se_intercept.&amp;lt;nnn&amp;gt;  is created in the folder specified 
in the SDEINTERCEPTLOC variable (where &amp;lt;nnn&amp;gt; is a unique number starting at 001).  
This file will contain error and warning messages.  Not all of these 
errors and warnings are issues you need to worry about; some are a normal part 
of using ArcSDE and are just warnings that are automatically handled by ArcSDE.  
It will take some time to learn how to read these files.  If necessary, you can get 
help interpreting the file from ESRI support.  A good strategy is to search the file 
from the bottom up since it's more likely that the real error is near the bottom.&lt;/p&gt;

&lt;h3&gt;ArcSDE Server error logs&lt;/h3&gt;
&lt;p&gt;Each entry in an ArcSDE Server error log contains three pieces of information: the time of the message, the name of the client machine, and the message.&amp;nbsp;  If you can identify the time your error occurred, you can 
search the log for any obvious error messages around the time the error occurred on your client machine.&lt;br&gt;&lt;/p&gt;


&lt;p&gt;ArcSDE Server error logs are written to the location specified by your SDE administrator, 
so you will need to contact your SDE administrator to gain access to these logs.  
(They are written to SDEHOME\etc\&amp;lt;sde_instance_name&amp;gt;.log, such as sde_esri_sde.log).&lt;/p&gt;

&lt;p&gt;To have more detailed information in the ArcSDE Server error logs, see the SDEVERBOSE setting in the topic &lt;a href="http://webhelpdev.esri.com/arcgisdesktop/9.3/index.cfm?topicname=the_dbinit.sde_file"&gt;The dbinit.sde file&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;DBMS logs and trace files&lt;/h3&gt;
&lt;p&gt;Most database management systems have the ability to log detailed information 
about database activities and queries.  Investigating these logs usually 
require assistance from your database administrator as a certain amount of 
database specific expertise is needed to gain useful information from their contents.&lt;/p&gt;

&lt;p&gt;DBMS logs contain information on the state of the database and any database related 
issues that may have occurred.  Things such as the database running out of 
space to store your data, dead locks, database system errors and much more are 
contained in these files.  &lt;/p&gt;

&lt;p&gt;DBMS trace files, on the other hand, are files that contain all the SQL 
statements and their return values for a session in the database.  When you 
request ArcSDE to perform an action, a lot of what is done is the running of SQL 
in the database.  The database trace file will contain all the SQL used by ArcSDE 
and the messages the database returned when running this SQL.  Any unexpected errors 
can be found in these files.&lt;/p&gt;&lt;img src="http://blogs.esri.com/Dev/aggbug.aspx?PostID=2601" width="1" height="1"&gt;</description><category domain="http://blogs.esri.com/Dev/blogs/geoprocessing/archive/tags/advanced/default.aspx">advanced</category><category domain="http://blogs.esri.com/Dev/blogs/geoprocessing/archive/tags/script+tools/default.aspx">script tools</category><category domain="http://blogs.esri.com/Dev/blogs/geoprocessing/archive/tags/ArcSDE/default.aspx">ArcSDE</category><category domain="http://blogs.esri.com/Dev/blogs/geoprocessing/archive/tags/Digging+deeper/default.aspx">Digging deeper</category></item><item><title>Tips and Tricks - Debugging Python script tools</title><link>http://blogs.esri.com/Dev/blogs/geoprocessing/archive/2008/09/01/Tips-and-Tricks-_2D00_-Debugging-Python-script-tools.aspx</link><pubDate>Mon, 01 Sep 2008 22:02:00 GMT</pubDate><guid isPermaLink="false">b60b3f0a-e2bd-4be5-8a18-822c697649ab:2573</guid><dc:creator>dmhoneycutt</dc:creator><slash:comments>4</slash:comments><comments>http://blogs.esri.com/Dev/blogs/geoprocessing/comments/2573.aspx</comments><wfw:commentRss>http://blogs.esri.com/Dev/blogs/geoprocessing/commentrss.aspx?PostID=2573</wfw:commentRss><description>&lt;p&gt;If you create your own script tools using Python, you'll appreciate these tips 
and tricks on debugging.&lt;/p&gt;

&lt;p&gt;Coding errors are inevitable and there are two basic ways to find out where the 
error occurred:&lt;/p&gt;

&lt;ol&gt;- Add some form of print statements to your code that help you isolate the problem.&lt;br&gt;
- Use an interactive debugger.&lt;/ol&gt;

&lt;p&gt;Using print statements to discover bugs is an obvious and common method.  Since script 
tools have access to the tool progress dialog, you can edit your script to include 
calls to AddMessage(), AddWarning(), or AddError() to print values and checkpoint 
messages to the progress dialog.  Another variation is to use an independent method 
of returning messages, like the win32ui module's MessageBox method.  This method 
displays a popup dialog.  Since you have to click OK on the dialog to continue 
execution, this method allows you to pace the execution of the script.  Here's an 
example using both methods:
&lt;/p&gt;

&lt;blockquote&gt;
&lt;pre&gt;&lt;font size="2" face="courier new, courier, mono"&gt;import arcgisscripting, win32ui, win32con&lt;br&gt;gp = arcgisscripting.create()&lt;br&gt;n = 5&lt;br&gt;&lt;br&gt;# Print message to progress dialog&lt;br&gt;#&lt;br&gt;gp.AddMessage("Value of n = " + str(n))&lt;br&gt;&lt;br&gt;# Issue a popup dialog with OK and Cancel button&lt;br&gt;#&lt;br&gt;val = win32ui.MessageBox("Value of n = " + str(n), "title", win32con.MB_OKCANCEL)&lt;br&gt;&lt;br&gt;# Based on the button clicked, you can branch execution&lt;br&gt;#&lt;br&gt;if val == 1:&lt;br&gt;    gp.AddMessage("You clicked OK")&lt;br&gt;else:&lt;br&gt;    gp.AddError("You clicked Cancel")&lt;br&gt;    raise arcgisscripting.ExecuteError, "Execution stops due to Cancel button click"&lt;br&gt;&lt;br&gt;gp.AddMessage("This statement reached")&lt;br&gt;&lt;/font&gt;&lt;br&gt;&lt;/pre&gt;
&lt;/blockquote&gt;


&lt;p&gt;The other method is to use a Python IDE (Integrated Development Environment) 
that supports debugging, such as:&lt;/p&gt;

&lt;ol&gt;- Python IDE that is installed with Python&lt;br&gt;
- PythonWin, available on the web at &lt;a href="https://sourceforge.net/projects/pywin32"&gt;https://sourceforge.net/projects/pywin32&lt;/a&gt;&lt;br&gt;
- Commercial systems, such as Wing IDE (&lt;a href="http://wingware.com/"&gt;http://wingware.com&lt;/a&gt;)&lt;/ol&gt;


&lt;p&gt;Debuggers allow you to set breakpoints, step in, out, and over individual lines 
of code, and examine the contents of variables, all without modifying your code.  
Compared to inserting print statements, debuggers are much more efficient and 
usually allow you to quickly isolate your bug.&amp;nbsp; The illustration below shows how to use debug mode in PythonWin.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.esri.com/Dev/photos/geoprocessing/picture2576.aspx" target="_blank"&gt;&lt;img src="http://blogs.esri.com/Dev/photos/geoprocessing/images/2576/450x341.aspx" border="0"&gt;&lt;/a&gt;&amp;nbsp;&lt;/p&gt;

&lt;p&gt;One way to use a debugger is to open your script directly in your IDE, modify 
it so that all parameters have values, and then proceed with debugging.  This works 
reasonably well in simple cases.  However, if your script uses layer or table view 
parameters, these variables need created on the fly.  Complex parameters like a 
Field Map or Spatial Reference are hard to create as variables. &lt;/p&gt;

&lt;p&gt;Ideally, you'd like to be able to open your script tool dialog, enter parameters, 
and then have the Python IDE launch with your code ready to be debugged.  You can 
do this with a few simple changes,&amp;nbsp; described below.&lt;/p&gt;

&lt;h4&gt;Use GetParameterAsText()&lt;/h4&gt;

&lt;p&gt;The first step is to modify your script so that it used GetParameterAsText() 
instead of sys.argv[], as discussed in &lt;a href="http://webhelp.esri.com/arcgisdesktop/9.3/index.cfm?TopicName=Understanding_script_tool_parameters" target="_blank"&gt;Understanding script tool parameters&lt;/a&gt;&lt;br&gt;&lt;/p&gt;

&lt;p&gt;This is a modification you can keep - there is no need to change your code 
back to using sys.argv[]. 
&lt;/p&gt;
&lt;h4&gt;Create a .bat file that launches your IDE with your .py as an argument&lt;/h4&gt;
&lt;p&gt;The next step is to create a one-line batch file that will be the source of 
your script tool (instead of your .py file).  This single line contains the pathname 
to your IDE plus the full path to the .py file, as illustrated below.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.esri.com/Dev/photos/geoprocessing/picture2571.aspx" target="_blank"&gt;&lt;img src="http://blogs.esri.com/Dev/photos/geoprocessing/images/2571/505x124.aspx" border="0"&gt;&lt;/a&gt;&amp;nbsp;&lt;/p&gt;


&lt;p&gt;Below are 3 examples of how to set your batch (.bat) file for commonly used IDEs.  
You'll need to confirm that the path is correct for your computer.  Other debuggers 
are of course valid options, and can be called in a similar fashion.&lt;/p&gt;

&lt;i&gt;Python IDLE&lt;/i&gt;&lt;br&gt;
&lt;font face="courier new, courier, mono"&gt;"C:\Python25\pythonw.exe" "C:\Python25\Lib\idlelib\idle.pyw" "C:\mytools\myscript.py"&lt;/font&gt;&lt;br&gt;
&lt;br&gt;
&lt;i&gt;PythonWin&lt;/i&gt;&lt;br&gt;
&lt;font face="courier new, courier, mono"&gt;"C:\Python25\Lib\site-packages\pythonwin\Pythonwin.exe" "C:\mytools\myscript.py"&lt;/font&gt;&lt;br&gt;
&lt;br&gt;
&lt;i&gt;Wing IDE 2.1&lt;/i&gt;&lt;br&gt;
&lt;font face="courier new, courier, mono"&gt;"C:\Program Files\Wing IDE 2.1\bin\wing.exe" "C:\mytools\myscript.py"&lt;/font&gt;&lt;br&gt;
&lt;h4&gt;Reset script tool path to the .bat file&lt;/h4&gt;
&lt;p&gt;The next step is to change your script tool properties to use this new batch file.  
In the ArcToolbox window, right-click your script tool and click Properties.  
Click the Source tab and change the script file to be the new .bat file you created, as illustrated below.  
Click OK.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.esri.com/Dev/photos/geoprocessing/picture2572.aspx" target="_blank"&gt;&lt;/a&gt;&lt;a href="http://blogs.esri.com/Dev/photos/geoprocessing/picture2572.aspx" target="_blank"&gt;&lt;img src="http://blogs.esri.com/Dev/photos/geoprocessing/images/2572/328x193.aspx" border="0"&gt;&lt;/a&gt;&lt;br&gt;&amp;nbsp;&lt;/p&gt;

&lt;h4&gt;Execute and debug your tool&lt;/h4&gt;
&lt;p&gt;Now you can open the script tool from the ArcToolbox window, enter the parameters, 
and click OK.  Shortly afterwards, the debugging application specified in your batch 
file will open with your Python script displayed.  At this point, you are free to interact 
with the debugging application as you would normally.  You can set a breakpoint and
let the script run to the breakpoint and use any other options the debugger allows.  
Parameter values you entered in the dialog will get picked up by GetParameterAsText().&lt;/p&gt;

&lt;p&gt;When running the script, any interaction you would normally expect between the script 
and the application will still occur.  So, if you're using methods like AddMessage(), 
AddWarning(), or AddError(), these messages will show up in the application.  If you are 
using progressor methods (new at 9.3), the progressor will be updated in the tool 
dialog as you walk through your script.  Once the script is finished, you can return 
back to the application by closing your debugger.  
&lt;/p&gt;

&lt;h4&gt;Reset the script tool source&lt;/h4&gt;
&lt;p&gt;Once you have fixed your bugs, you can reset the source to the script file from 
the .bat file back to the .py file.&lt;/p&gt;

&lt;br&gt;
&lt;p&gt;Looking ahead to future releases, we will have integrated options that will 
make this process smoother.  But for now, and with a few little tricks, you can 
easily perform your script tool debugging.&lt;/p&gt;&lt;img src="http://blogs.esri.com/Dev/aggbug.aspx?PostID=2573" width="1" height="1"&gt;</description><category domain="http://blogs.esri.com/Dev/blogs/geoprocessing/archive/tags/advanced/default.aspx">advanced</category><category domain="http://blogs.esri.com/Dev/blogs/geoprocessing/archive/tags/script+tools/default.aspx">script tools</category><category domain="http://blogs.esri.com/Dev/blogs/geoprocessing/archive/tags/Python/default.aspx">Python</category></item><item><title>New at 9.3 - Top Ten</title><link>http://blogs.esri.com/Dev/blogs/geoprocessing/archive/2008/07/29/New-at-9.3-_2D00_-Top-Ten.aspx</link><pubDate>Tue, 29 Jul 2008 16:44:00 GMT</pubDate><guid isPermaLink="false">b60b3f0a-e2bd-4be5-8a18-822c697649ab:2426</guid><dc:creator>dmhoneycutt</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.esri.com/Dev/blogs/geoprocessing/comments/2426.aspx</comments><wfw:commentRss>http://blogs.esri.com/Dev/blogs/geoprocessing/commentrss.aspx?PostID=2426</wfw:commentRss><description>
&lt;p&gt;
We asked the team to give us their &lt;b&gt;Top 10 New Geoprocessing Features in ArcGIS 9.3&lt;/b&gt;. 
The list quickly turned into the top 20, then the top 30, and then we had to stop.  
It's by no means exhaustive, but we think it includes 
the major improvements we made that will make your geoprocessing work a whole lot faster and easier.  
&lt;/p&gt;

&lt;p&gt;In no particular order, here's the first top 10 list.&lt;/p&gt;

&lt;h3&gt;Join Field tool&lt;/h3&gt;
&lt;p&gt;At last year's UC a common question was how to permanently add fields from one table to another.  
The solution at the time involved a combination of the Add Join, Add Field, and Calculate Field tools.  
With version 9.3, the new Join Field tool does all of this in one step, using a fraction of the time.  
As with Add Join, Join Field accepts two tables, each with a common attribute field.  
The tool joins the two tables based on this field and you have the option of selecting which 
additional fields you want to have included in the final output.  The Join Field output is a 
permanent update of the input table or feature class.&lt;/p&gt;

&lt;p&gt;&lt;i&gt;&lt;a href="http://blogs.esri.com/Dev/photos/geoprocessing/picture2422.aspx" target="_blank"&gt;&lt;img src="http://blogs.esri.com/Dev/photos/geoprocessing/images/2422/original.aspx" border="0"&gt;&lt;/a&gt;&lt;br&gt;&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;See the &lt;a href="http://webhelp.esri.com/arcgisdesktop/9.3/index.cfm?id=1669&amp;amp;pid=1667&amp;amp;topicname=Join_Field_%28Data_Management%29"&gt;Join Field&amp;nbsp; tool reference page&lt;/a&gt; for more information.&lt;br&gt;&lt;/p&gt;

&lt;h3&gt;Error messages&lt;/h3&gt;
&lt;p&gt;We standardized warning and error messages and gave each one a unique number. So now, when a 
warning or error comes up on a tool dialog, progress dialog, or command line window,
you can click the number 
to open a detailed description.  This description lists probable causes of the error or warning,
suggestions to remedy the situation, and links to relevant help topics. &lt;/p&gt;

&lt;p&gt;&amp;nbsp;&lt;a href="http://blogs.esri.com/Dev/photos/geoprocessing/picture2419.aspx" target="_blank"&gt;&lt;img src="http://blogs.esri.com/Dev/photos/geoprocessing/images/2419/640x303.aspx" border="0"&gt;&lt;/a&gt;&lt;br&gt;&lt;/p&gt;

&lt;p&gt;See &lt;a href="http://webhelp.esri.com/arcgisdesktop/9.3/index.cfm?TopicName=Understanding_geoprocessing_tool_errors_and_warnings"&gt;Understanding geoprocessing tool errors and warnings&lt;/a&gt; for more information&amp;nbsp;&lt;/p&gt;



&lt;h3&gt;Near with lines and polygons&lt;/h3&gt;

&lt;p&gt;Have you ever been required to find the nearest distances between a mixture of point, line, and polygon 
features?&amp;nbsp; This would seem to be a very easy operation. However, until ArcGIS 9.3, 
it required building a script or program. With ArcGIS 9.3, the &lt;a href="http://webhelp.esri.com/arcgisdesktop/9.3/index.cfm?id=1273&amp;amp;pid=1268&amp;amp;topicname=Near_%28Analysis%29"&gt;Near tool&lt;/a&gt; is improved to support 
all feature types.&amp;nbsp; In addition, multiple near feature 
classes can be supplied. &lt;/p&gt;

&lt;h3&gt;Generate Near Table tool&lt;/h3&gt;
&lt;p&gt;The Near tool modifies the attributes of the input feature class. This often caused problems 
when the input dataset was read only. With ArcGIS 9.3, there is a new &lt;a href="http://webhelp.esri.com/arcgisdesktop/9.3/index.cfm?id=1271&amp;amp;pid=1268&amp;amp;topicname=Generate_Near_Table_%28Analysis%29"&gt;Generate Near Table tool&lt;/a&gt;.  
Instead of modifying the input feature class as Near does, Generate Near Table creates a new table containing the 
proximity information. This tool also contains an option to find the distances to &lt;i&gt;all&lt;/i&gt; features, 
not just the nearest.&lt;/p&gt;

&lt;h3&gt;Performance improvement using ArcSDE data with GpTools&lt;/h3&gt;
&lt;p&gt;We've made three major improvements when using ArcSDE data with geoprocessing tools:&lt;/p&gt;
 

&lt;ul&gt;
&lt;p&gt;By far the most dramatic improvement is the result of better management of ArcSDE connections.
Instead of creating multiple connections to ArcSDE for one execution of a tool,
we now create only one connection. (This issue is also resolved in version 9.2 
service pack 5).&lt;/p&gt;
&lt;/ul&gt;

&lt;ul&gt;
&lt;p&gt;The performance of the Append tool has improved because the spatial index of the
output dataset is created only once instead of many times.&lt;/p&gt;
&lt;/ul&gt;

&lt;ul&gt;
&lt;p&gt;We made many improvements to our internal topology analysis engine used by overlay tools. 
The performance of tools in the Analysis toolbox has greatly improved when using 
large ArcSDE datasets.&lt;/p&gt;
&lt;/ul&gt;

&lt;h3&gt;Python scripts run in process&lt;/h3&gt;
&lt;p&gt;In 9.2 all Python [.py] script tools created a separate process and executed outside the 
application process. The way you noticed this is that it took as much as 5 to 10 seconds 
for a script tool to start up. In 9.3, we're taking advantage of the application already 
running. This greatly improves script tool performance in two major areas: Initial start-up of a 
script tool and the use of cursors within the script tool. It also greatly improves the start-up 
performance of scripts tools using smaller datasets as inputs.&lt;/p&gt;

&lt;p&gt;See &lt;a href="http://webhelp.esri.com/arcgisdesktop/9.3/index.cfm?id=861&amp;amp;pid=854&amp;amp;topicname=Running_a_script_in_process"&gt;Running a script in process&lt;/a&gt; for more information.&amp;nbsp;&lt;/p&gt;

&lt;h3&gt;Geodesic buffers&lt;/h3&gt;

&lt;p&gt;In 9.2, the Buffer tool created buffer polygons assuming that all coordinates
represented a flat Euclidean space instead of a spherical space, like the Earth.&lt;/p&gt;

&lt;p&gt;In 9.3, the Buffer tool will create geodesic buffers if:&lt;/p&gt;

&lt;ul&gt;
&lt;p&gt;The features to be buffered are points or multipoints.&lt;/p&gt;
&lt;/ul&gt;

&lt;ul&gt;
&lt;p&gt;The input feature are in geographic coordinates (i.e., longitude/latitude).&lt;/p&gt;
&lt;/ul&gt;

&lt;ul&gt;
&lt;p&gt;The buffer distance is in Euclidean linear units (i.e, feet, meters).&lt;/p&gt;
&lt;/ul&gt;

&lt;p&gt;The output buffer polygons will take into account that longitudinal distance varies
varies with latitude, as illustrated below.&lt;/p&gt;

&lt;p&gt;&lt;i&gt;&lt;a href="http://blogs.esri.com/Dev/photos/geoprocessing/picture2421.aspx" target="_blank"&gt;&lt;img src="http://blogs.esri.com/Dev/photos/geoprocessing/images/2421/original.aspx" border="0"&gt;&lt;/a&gt;&lt;br&gt;&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;&amp;nbsp;See &lt;a href="http://webhelp.esri.com/arcgisdesktop/9.3/index.cfm?topicname=how_buffer_%28analysis%29_works"&gt;How Buffer works&lt;/a&gt; for more information on geodesic buffers.&lt;br&gt;&lt;/p&gt;

&lt;h3&gt;Script tool validation&lt;/h3&gt;
&lt;p&gt;You can now have your script tools behave like system tools (those that come
with ArcGIS).  You can enable (gray-out) parameters based on values in other
parameters, provide keyword lists that dynamically change, put parameters into
different categories, calculate default values on-the-fly, and update the 
description of output data for use in ModelBuilder.  These capabilities are all
found on the new Validation tab you see on a script tool's property page.&lt;/p&gt;

&lt;p&gt;See &lt;a href="http://webhelp.esri.com/arcgisdesktop/9.3/index.cfm?TopicName=Customizing_script_tool_behavior"&gt;Customizing script tool behavior&lt;/a&gt; for more information&amp;nbsp;&lt;/p&gt;

&lt;h3&gt;Spatial Statistics: Ordinary Least Square Regression and&lt;/h3&gt;
&lt;h3&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Geographically Weighted Regression Tools&lt;/h3&gt;
&lt;p&gt;The Spatial Statistics toolbox has powerful pattern analysis tools to help 
answer "Where?" questions like:&lt;/p&gt;

&lt;ul&gt;
&lt;p&gt;Where are people persistently dying young in the United States?&lt;/p&gt;
&lt;/ul&gt;

&lt;ul&gt;
&lt;p&gt;Where are our kids consistently turning in high test scores? &lt;/p&gt;
&lt;/ul&gt;

&lt;ul&gt;
&lt;p&gt;Where do we seen an unexpectedly high number of traffic accidents?&lt;/p&gt;
&lt;/ul&gt;

&lt;p&gt;With ArcGIS 9.3, new regression analysis tools are added that allow you
to answer the next logical set of questions relating to "Why?" like:&lt;/p&gt;

&lt;ul&gt;
&lt;p&gt;Why are people persistently dying young in particular places across the United States?&lt;/p&gt;
&lt;/ul&gt;

&lt;ul&gt;
&lt;p&gt;What are the factors contributing to consistently high test scores?&lt;/p&gt;
&lt;/ul&gt;

&lt;ul&gt;
&lt;p&gt;Why are there so many traffic accidents in particular hot spot locations?&lt;/p&gt;
&lt;/ul&gt;

&lt;p&gt;Ordinary Least Squares Regression (OLS) is a commonly used &lt;i&gt;global&lt;/i&gt; linear 
regression method used to generate predictions, or to model a dependent 
variable or process, in terms of its relationships to a set of explanatory 
variables.  It creates a single equation to represent those relationships.  
OLS is the starting point for all regression analysis (including all spatial 
regression analysis).  It often breaks down when used with spatial data, 
however, in the case where the relationships being modeled change across the 
study area.  An education variable, for example, might be a good predictor 
of crime rates in one part of the study area, but may not be significant 
in another part of the study area.  Geographically Weighted Regression (GWR), 
on the other hand, allows data relationships to vary.  GWR is one of 
several spatial regression techniques increasingly used in geography and 
other disciplines.  It provides a local model of the variable or process 
you are trying to understand/predict by fitting a regression equation to 
every feature in the dataset.  GWR constructs these separate equations by 
incorporating the dependent and explanatory variables of features failing 
with a particular user-specified bandwidth of each target feature.  
ArcGIS 9.3 includes "Regression Analysis Basics" and "Result Interpretation" 
documentation with strategies and graphics aimed at helping the user apply 
these methods effectively.&lt;/p&gt;

&lt;p&gt;See &lt;a href="http://webhelp.esri.com/arcgisdesktop/9.3/index.cfm?TopicName=An_overview_of_the_Modeling_Spatial_Relationships_toolset"&gt;An overview of the Modeling Spatial Relationships toolset&lt;/a&gt; for more information.&amp;nbsp;&lt;/p&gt;

&lt;h3&gt;Batch Grid: deferred validation&lt;/h3&gt;
&lt;p&gt;If you use a tool in batch mode, you may have noticed that filling in the
batch grid became slow if more than 10 rows or so were entered.  This
was due to the fact that every value in every row was validated whenever you 
clicked the mouse in a cell. &lt;/p&gt;

&lt;p&gt;In 9.3, you control when validation occurs by click the Check Values button in 
the lower right of the batch grid, as illustrated below.&lt;/p&gt;

&lt;p&gt;&amp;nbsp;&lt;a href="http://blogs.esri.com/Dev/photos/geoprocessing/picture2420.aspx" target="_blank"&gt;&lt;img src="http://blogs.esri.com/Dev/photos/geoprocessing/images/2420/original.aspx" border="0"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Validation always occurs when you click the OK button.&amp;nbsp; &lt;/p&gt;
&lt;p&gt;See &lt;a href="http://webhelp.esri.com/arcgisdesktop/9.3/index.cfm?TopicName=Using_the_batch_grid_control"&gt;Using the batch grid control&lt;/a&gt; for more information. You can find the discussion of the Check Values button at the bottom of the topic. &amp;nbsp;&lt;/p&gt;&lt;img src="http://blogs.esri.com/Dev/aggbug.aspx?PostID=2426" width="1" height="1"&gt;</description><category domain="http://blogs.esri.com/Dev/blogs/geoprocessing/archive/tags/beginner/default.aspx">beginner</category><category domain="http://blogs.esri.com/Dev/blogs/geoprocessing/archive/tags/advanced/default.aspx">advanced</category><category domain="http://blogs.esri.com/Dev/blogs/geoprocessing/archive/tags/New+at+9.3/default.aspx">New at 9.3</category></item><item><title>Guidelines for submitting tools to the Model and Script Tool Gallery</title><link>http://blogs.esri.com/Dev/blogs/geoprocessing/archive/2008/07/29/Guidelines-for-submitting-tools-to-the-Model-and-Script-Tool-Gallery.aspx</link><pubDate>Tue, 29 Jul 2008 16:42:00 GMT</pubDate><guid isPermaLink="false">b60b3f0a-e2bd-4be5-8a18-822c697649ab:2424</guid><dc:creator>dmhoneycutt</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.esri.com/Dev/blogs/geoprocessing/comments/2424.aspx</comments><wfw:commentRss>http://blogs.esri.com/Dev/blogs/geoprocessing/commentrss.aspx?PostID=2424</wfw:commentRss><description>
&lt;p&gt;
The link below is to a PDF document containing guidelines for making a submittal to the Model and Script Tool Gallery. This document discusses:&lt;/p&gt;

&lt;ul style="list-style-type:none;"&gt;
&lt;li&gt;The contents of the ZIP file you upload when making a submission.&lt;/li&gt;
&lt;/ul&gt;

&lt;ul style="list-style-type:none;"&gt;
&lt;li&gt;How to ensure that your submission is 
&lt;b&gt;portable&lt;/b&gt;. That is, when someone downloads your submission, all your tools work without
 modification.&lt;/li&gt;
&lt;/ul&gt;


&lt;ul style="list-style-type:none;"&gt;
&lt;li&gt;Advice on creating a submission that gets good user ratings because it's well documented and robust.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;&lt;a href="http://resources.esri.com/help/9.3/geoprocessing/pdf/Submission_guidelines.pdf" title="Guidelines for submitting Model and Script Tools" target="_blank"&gt;Guidelines for submitting Model and Script Tools [PDF]&lt;/a&gt;&lt;br&gt;&lt;/p&gt;&lt;img src="http://blogs.esri.com/Dev/aggbug.aspx?PostID=2424" width="1" height="1"&gt;</description><category domain="http://blogs.esri.com/Dev/blogs/geoprocessing/archive/tags/beginner/default.aspx">beginner</category><category domain="http://blogs.esri.com/Dev/blogs/geoprocessing/archive/tags/advanced/default.aspx">advanced</category></item><item><title>Welcome to the geoprocessing resource center</title><link>http://blogs.esri.com/Dev/blogs/geoprocessing/archive/2008/07/29/Welcome-to-the-geoprocessing-resource-center.aspx</link><pubDate>Tue, 29 Jul 2008 16:41:00 GMT</pubDate><guid isPermaLink="false">b60b3f0a-e2bd-4be5-8a18-822c697649ab:2423</guid><dc:creator>dmhoneycutt</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.esri.com/Dev/blogs/geoprocessing/comments/2423.aspx</comments><wfw:commentRss>http://blogs.esri.com/Dev/blogs/geoprocessing/commentrss.aspx?PostID=2423</wfw:commentRss><description>&lt;p&gt;
We're all excited about the launch of this new geoprocessing blog.
&lt;/p&gt;

&lt;p&gt;
The
scope of this blog will range from introductory information regarding
general geoprocessing functionality to some more advanced topics and
developer related material. We’ll be blogging on things like best
practices, tips and tricks, new and existing functionality, and example
workflows. &lt;/p&gt;


&lt;p&gt;Be sure to visit the Model and Script tool gallery where you can download model and script tools developed by the geoprocessing community and submit your own tools.&lt;/p&gt;

&lt;p&gt;
This blog is written by the Geoprocessing Development Team and we’re hoping
that it grows into a valuable resource for you. Stay
tuned…&lt;/p&gt;&lt;img src="http://blogs.esri.com/Dev/aggbug.aspx?PostID=2423" width="1" height="1"&gt;</description><category domain="http://blogs.esri.com/Dev/blogs/geoprocessing/archive/tags/beginner/default.aspx">beginner</category><category domain="http://blogs.esri.com/Dev/blogs/geoprocessing/archive/tags/advanced/default.aspx">advanced</category></item></channel></rss>