• Lidar Solutions in ArcGIS_part2: Creating raster DEMs and DSMs from large lidar point collections

    This blog is written by Clayton Crawford, a Product Engineer in the Software Products Group’s 3D Team in Redlands.

    This is the second blog in a series on Lidar Solutions in ArcGIS. The first can be found here: Lidar Solutions in ArcGIS_part1: Assessing Lidar Coverage and Sample Density.

    Lidar Solutions in ArcGIS_part2: Creating raster DEMs and DSMs from large lidar point collections

    Raster, or gridded, elevation models are one of the most common GIS data types. They can be used in many ways for analysis and are easily shared. Lidar provides us with the opportunity to make high quality elevation models of two distinct flavors: first return and ground. A first return surface includes tree canopy and buildings and is often referred to as a Digital Surface Model (DSM). The ground, or bare earth, contains only the topography and is frequently called a Digital Elevation Model (DEM).

                         

     

    ArcGIS provides tools to take large lidar point collections, and optionally other surface related information like photogrammetric breaklines, and use them to produce high quality raster surfaces.

    Coming up with a plan

    Before continuing some basic factors need to be evaluated:

    • Extent of lidar coverage
    • Number of lidar points and point density
    • Desired output raster resolution
    • Extent of output raster(s)
    • Format of output raster(s)

    Consideration of these factors will help determine whether you’ll be producing one raster or a collection. Part of this process requires you figure out how many rows and columns you’re willing to have in one raster. This depends on what you intend to do with the raster in terms of analysis, display, and potential sharing or distribution of the data. The desire to work off one dataset for analysis can be in conflict with practical constraints associated with dataset size. Another thing to consider is the amount of lidar you have. Trying to process 10 billion lidar points as one dataset, while possible, is likely to prove unwieldy. It’s pretty much a given you’ll be making multiple rasters from this amount of lidar, so consider splitting up the lidar processing as well. Not only does this keep individual datasets at reasonable sizes, it keeps process duration on those datasets shorter. The longer a process takes to execute, the more likely something’s going to go wrong (e.g., power outage). We all want to reduce risk, right?

    If you’ve determined you need to split up your data, the next question is how. Will it be based on a regular grid system, political boundaries, or division based on an anticipated application? Since lidar collections tend to have multiple uses, splitting them up based on a regular grid system or political divisions like county boundaries makes the most sense. An engineer can mosaic the different pieces he or she needs for an individual project. If the intended use is weighted heavily for one type of application, such as hydrology, then use divisions logical for the application. For example, in the case of hydrology, watershed boundaries are a good candidate.

    ArcGIS supports many raster formats, so you have a choice of what format to write to. This decision is best based on the intended use of the product. If it’s to be shared with the general public you might think about distributing in either TIFF or JPEG format. For analysis on the ArcGIS platform, the ESRI GRID format is best. This is the native format for many functions so to improve I/O efficiency, and therefore processing time, using GRID is the way to go.

    The first step in getting from lidar points to raster is loading the points into a GDB. If you haven’t already done so, review the first part of this series. Use the link at the beginning of this blog to get to it.

    Using the Point to Raster tool

    If your only source of data is the lidar you can use the Point to Raster tool to produce a raster elevation models. While this does not produce the highest quality result possible lidar tends to be so dense that for many applications the accuracy is good enough and the convenience and speed of this tool make it worthwhile.

    • If producing a bare earth surface, or DEM, use just the ground lidar points.
    • Set the Value field parameter on the tool to Shape to use the z values from the multipoint vertices.
    • Set the Cell assignment type to either MIN or MEAN. MIN will bias output heights to local lows while MEAN is more general purpose.
    • To produce a first return surface, or DSM, use the 1st return lidar points with the MAX option of the tool since you want to bias the output to local highs.

                                        

    The Point to Raster tool produces gridded elevation models from lidar point sets.

    While Point to Raster offers the easiest and fastest way to produce a raster from lidar, it has a significant drawback. You can end up with many NoData cells since it only returns values for cells that have one or more points in them. The problem is exacerbated when only using ground points to make a DEM because gaps in the data occur where there’s vegetation and buildings obscuring the ground. To reduce the salt & pepper effect of NoData vs. data cells you can increase the output cellsize relative to the average point spacing. You can also reduce the number of NoData cells after execution of Point to Raster by using this expression in Spatial Analyst calculator on the output (in this example the output from Point to Raster is called ‘point2ras):

               


    You can run the expression multiple times to fill in larger NoData areas, but I wouldn’t recommend running it more than a couple times. It’s better to just accept larger void areas as a consequence of using this approach.

                       

     

    Using the Terrain Dataset

    If you have photogrammetric breaklines to go along with your lidar, or need higher quality results than can be produced with the Point to Raster tool, use the terrain dataset. For an overview of the terrain dataset and related help topics check out the online help here.

                           

    On the left is a surface made without breaklines along the river banks. The image on the right has breakline enforcement. Breaklines are important for maintaining the definition of water related features in the elevation model.

    Breaklines are used to capture linear discontinuities in the surface. The most common types are edge of pavement, lake shorelines, single line drains for small rivers and double line drains for large rivers. Sometimes breaklines are also collected to help define and sculpt the surface without necessarily representing discontinuities. Examples of these include contour-like form lines and the crests of rounded ridges.

    Breaklines, while frequently used in bare earth models, tend to be detrimental when used with first return surfaces because they can be in conflict with the above ground points. For example, breaklines capturing road edge of pavement can be coincident in XY but different in Z to points in tree canopy overhanging the road. Because of this, consider excluding breaklines from your first return surface or at least those where you know there’s potential conflict.

    The most efficient means of organizing breaklines for use in a terrain dataset – see table below- is to separate them into different feature classes based on Surface Feature Type (SFType). SFType controls how the features are enforced in the model and how the natural neighbor interpolator, used during rasterization, interprets the surface as it crosses over these features. A distinct break in slope will occur across ‘hard’ features but not across ‘soft’ features.

                                  

    Common input measurement types and recommend feature class storage type and SFType settings for terrain dataset definition.

    It’s best for the sake of terrain performance to place all hardlines together in one feature class. It’s understood this might not be possible, for example, if you have the need to keep road and water features separate. It’s OK, just keep in mind the fewer feature classes used to define a terrain the better.

    The ‘Replace’ SFType deserves special mention. This type is used to force everything inside a polygon to be set flat at a constant height. It’s used mostly for lakes when there’s inadvertently other data inside them, such as lidar points, whose heights are not exactly the same as the shoreline and therefore prevent the water bodies from being flat. Use of the Replace SFType does incur more processing cost than normal hard or softlines so it’s best to avoid. Ideally there ought not be lidar samples in your water bodies (consider adding this as a stipulation in the contract with your data provider), but if you do, you can either use the Replace SFType to handle them or get rid of the offending points before building your terrain using the Erase geoprocessing tool.

    If you’ll be producing both bare earth and first return surfaces via terrain datasets, load the lidar points into two different multipoint feature classes, a feature class for the ground points and a feature class for the above ground points. Your bare earth terrain is defined with a reference to just the ground points. Your first return terrain references the same ground point feature class as the bare earth terrain and has the additional reference to the above ground points. Yes, this means two different terrains can reference the same feature class.

    Starting with ArcGIS 9.3, terrain datasets can be pyramided using one of two point thinning filters: z-tolerance and windowsize. For DEM production you can use either. If you intend to rasterize from the full resolution point set, then use the windowsize filter for terrain construction because it’s significantly faster. If you’re willing to use thinned data for analysis, which is reasonable if the lidar is oversampled for your needs, use the z-tolerance filter. While more time consuming, it’s most appropriate because it provides an estimate of vertical accuracy of the thinned representation. For DSM production use the windowsize filter with the MAX option.

    Use the Terrain To Raster tool to produce your rasterized elevation model. This provides options for interpolation, output cellsize, and which pyramid level to use from the terrain.

                                           


    The Terrain to Raster tool produces gridded elevation models from terrain datasets.

    For interpolation, the natural neighbors options is your best bet. While not as fast as linear interpolation, it generally produces better results both in terms of aesthetics and accuracy. Set the output cellsize relative to the lidar point sample density. You won’t gain anything by using a cellsize that’s substantially smaller than the average point spacing. Also, make sure to set the analysis extent, as set through the environment, for the extraction of subsets where appropriate. The use of a snap raster can also be of use for the sake of alignment of raster outputs.

    Conclusion

    Using either Point To Raster or Terrain To Raster geoprocessing tools you can process hundreds of millions, even billions, of lidar points into hi-resolution gridded DEMs and DSMs. These can then be used with the large collection of raster tools available in ArcGIS for analysis. They’re also great for making maps (see graphic below) and, due to their simple data structure, easy to share.

             

    Color hillshade for a DSM of Jasper County, South Carolina. Made from a terrain dataset built on top of 1.7 billion lidar points for the county.

    That’s it for the second part of this series on Lidar Solutions in ArcGIS. Check back for the next part: Data Area Delineation from Lidar Points.

  • Tips and tricks - Error handling in Python script tools

    I recently had a project that involved creating lots of Python script tools. Since other people were going to use these tools, I wanted my error handling to be robust and informative. This post is about some tips and tricks I discovered during this project.

    Error handling basics

    The basics of handling Python errors are covered in the 9.3 help topic Error handling with Python. The Python.org document Errors and Exceptions has more detailed information.

    Tip #1 - Use the arcgisscripting.ExecuteError exception

    In version 9.2, we introduced the arcgisscripting object along with a new exception class, arcgisscripting.ExecuteError. (This arcgisscripting.ExecuteError exception class wasn't documented in version 9.2, so few people knew about it.)  The arcgisscripting.ExecuteError exception is thrown whenever a geoprocessing tool or geoprocessing function encounters an error. What this means is that you can divide errors into two groups, geoprocessing errors (those that throw the arcgisscripting.ExecuteError exception) and everything else.  You can then handle the errors differently, as demonstrated in the code below:

    import arcgisscripting
    gp = arcgisscripting.create(9.3)
    try:
    result = gp.getcount("C:/blah.shp")
    # x = y

    # Return GEOPROCESSING specific errors
    #

    except arcgisscripting.ExecuteError:
    gp.AddError(gp.GetMessages(2))

    # Return any PYTHON or system specific errors
    #

    except:
    gp.AddError("Python or system error occurred")

    The code above is used as the source for a script tool. To keep things simple, the script tool has no parameters. When the script tool is executed, the call to getcount produces an error because the dataset "C:/blah.shp" doesn't exist. As a result, the progress dialog looks as follows:

     

    To prove how geoprocessing errors and Python errors are handled differently, change the two lines of code as follows:

        # result = gp.getcount("C:/blah.shp")
    x = y

    Now when the script is executed, an error will occur because the variable 'y' is undefined, and the progress dialog will display as follows:

     

    Tip #2 - Beware of getting error messages from a result object

    Before moving on, a quick word about the result object, shown below:

        result = gp.getcount("C:/blah.shp")

    If the call to getcount above raises an exception, the result object is null. This means you cannot retrieve error messages from the result object. For example:

    import arcgisscripting
    gp = arcgisscripting.create(9.3)
    try:
    result = gp.getcount("C:/blah.shp")

    # Return GEOPROCESSING specific errors
    # (this method is INCORRECT!)

    except arcgisscripting.ExecuteError:
    gp.AddError(result.GetMessages(2))

    # Return any PYTHON or system specific errors
    #

    except:
    gp.AddError("Python or system error occurred")

    The above code will fail with the message "name 'result' is not defined". This is due to the fact that the result object is null. Since the result object is null, a Python error will be raised since a null object doesn't have a GetMessages() method. Note -- a result object created by calling a geoprocessing service on an ArcGIS Server is never null. Null result objects a created only when a tool is run locally and it raises an error.  For more information about using the result object, see Getting results from a geoprocessing tool.

    Tip #3 - Use AddReturnMessage() to preserve links to error codes

    In version 9.3, geoprocessing error numbers shown in the progress dialog are hyperlinks to a help page that further describes the error. To enable hyperlinks for errors in your script, you need to use the AddReturnMessage() method instead of the AddError method, as follows:
    import arcgisscripting
    gp = arcgisscripting.create(9.3)
    try:
    result = gp.getcount("C:\\blah.shp")

    # Return GEOPROCESSING specific errors
    #

    except arcgisscripting.ExecuteError:
    for msg in range(0, gp.MessageCount):
    if gp.GetSeverity(msg) == 2:
    gp.AddReturnMessage(msg)


    # Return any PYTHON or system specific errors
    #

    except:
    gp.AddError("Python or system error occurred")

    Now when the script is executed, the progress dialog will look as follows:


     

    Tip #4 -- Use traceback to return more information about the error

    The help system topic Error handling with Python shows you how to use Python's traceback to retrieve the line number causing the error, the name of the .py file, and, for Python errors, a description of the error.

    At version 9.3, you can run script tools in-process, as described in Running a script in process. Scripts run in-process execute much faster than scripts run out-of-process, so you always want to run the script in-process. When a script is run in-process, ArcGIS reads the .py file into memory and then executes it. Because ArcGIS puts the .py files into memory, the Python traceback module doesn't know the name of the .py file and will report the file name as "<string>". If you want to report the name of the .py file causing the error (very useful for debugging), you'll have to provide it yourself.

    The script below has a local routine, trace(), that uses traceback to return the line number, the file name, and the error description. The routine also contains the the hard-coded file name (shown in bold) which you must change for your script.

    import arcgisscripting
    gp = arcgisscripting.create(9.3)
    try:
    def trace():
    import os, sys, traceback
    tb = sys.exc_info()[2]
    tbinfo = traceback.format_tb(tb)[0] # script name + line number
    line = tbinfo.split(", ")[1]

    # Construct the pathname to this script. Get the pathname
    # to the folder containing the script using sys.path[0].
    # Modify line below and replace 'myscript.py' with the name of
    # this script.
    #

    filename = sys.path[0] + os.sep + "myscript.py"

    # Get Python syntax error
    #

    synerror = traceback.format_exc().splitlines()[-1]
    return line, filename, synerror
    if __name__ == '__main__':
    # y = x
    result = gp.getcount("C:/blah.shp")

    except arcgisscripting.ExecuteError:
    # Call our trace routine to retrieve line number and filename.
    # (returned variable 'err' is ignored since this is a gp error.
    #

    line, filename, err = trace()
    gp.AddError("Geoprocessing error on " + line + " of " + filename + " :")
    for msg in range(0, gp.MessageCount):
    if gp.GetSeverity(msg) == 2:
    gp.AddReturnMessage(msg)

    except:
    line, filename, err = trace()
    gp.AddError("Python error on " + line + " of " + filename)
    gp.AddError(err)

    Below are illustrations of the progress dialog showing the line number and file name for both a geoprocessing error and a Python syntax error (by commenting out the "y = x" statement).

     

     

    Tip #5 -- Use Finally statement to clean up cursors

    Something I discovered by reading the Python doc Errors and Exceptions is the 'finally' statement. No matter what happens in your Python script, code in a 'finally:' block always gets executed. It's a great place to put clean-up actions, such as deleting cursors, as shown in the code below.

    import arcgisscripting
    gp = arcgisscripting.create(9.3)

    def trace():
    import os, sys, traceback
    tb = sys.exc_info()[2]
    tbinfo = traceback.format_tb(tb)[0]
    line = tbinfo.split(", ")[1]
    filename = sys.path[0] + os.sep + "testscript.py"
    synerror = traceback.format_exc().splitlines()[-1]
    return line, filename, synerror

    if __name__ == '__main__':
    # Define variables for a cursor and its row
    #

    cursor, row = None, None
    try:
    cursor = gp.searchcursor("E:/Data/CityOfSanFrancisco.gdb/FireStations")
    row = cursor.Next()
    while row:
    # Code here...
    # for demonstration...this next statement will cause an error

    y = x
    row = cursor.Next()
    except arcgisscripting.ExecuteError:
    line, filename, err = trace()
    gp.AddError("Geoprocessing error on " + line + " of " + filename + " :")
    for msg in range(0, gp.MessageCount):
    if gp.GetSeverity(msg) == 2:
    gp.AddReturnMessage(msg)
    except:
    line, filename, err = trace()
    gp.AddError("Python error on " + line + " of " + filename)
    gp.AddError(err)
    finally:
    # Close cursor and row objects.
    #

    del row, cursor

    # Print a message for demo purposes
    #

    gp.AddMessage("\n ** Cursor and row have been deleted ** \n")

    As illustrated below, the cursor gets deleted even if there is an error in the script.


    In the main body of the script, the cursor and row object variables are declared and initialized to None (shown in bold in the above code).  This ensures that these two variables exist when the del statement in the finally clause is executed; if you try to delete a non-existent variable, an exception will be thrown.  

    About cursors and the del statement

    The Python del statement deletes a variable. You can use it to delete any Python variable, such as a list or dictionary. However, you rarely need to delete native Python variables.  The del statement is mainly used for deleting non-native variables, such as geoprocessing cursors and rows obtained from the cursor. When you delete a cursor and its row, all pending changes to the row (caused by an update or insert cursor) are flushed and all locks on the dataset are removed.  You should always delete cursors and rows obtained from the cursor.  When deleting a cursor, delete the row object first, then the cursor.


  • Lidar Solutions in ArcGIS_part 1: Assessing Lidar Coverage and Sample Density

    This blog post is written by Clayton Crawford, Product Engineer in the Software Products Group’s 3D Team in Redlands.

    This post is the first in a series called “Lidar solutions in ArcGIS”. The series will cover Lidar processing tasks and workflows. And it will show you how to manage these vast point collections and outline approaches for mining information from them.

    Let me state an important point up front: This series is about Lidar point processing. If you have Lidar derived raster data then it won’t be of direct use, but if you need to learn how to make those rasters then read on. Also important to note: the type of Lidar involved in this discussion is collected from plane or helicopter with a laser scanner pointed downward. With this type of Lidar you can make bare earth surfaces for topographic mapping and 1st return surfaces that include vegetation and buildings. It’s not about the type of Lidar where data is collected at side-on angles.

    Note that some of the tasks covered in the series require a 3D Analyst extension license.

    Here are the topics I plan to cover:

    • Assessing Lidar coverage and sample density
    • Creating raster DEMs and DSMs from large Lidar point collections
    • Data area delineation from Lidar points
    • Using Lidar to estimate forest canopy density and height
    • Creating intensity images from Lidar
    • Updating a portion of a terrain dataset with new measurements
    • Minimizing noise from Lidar for contouring and slope analysis
    • Business partner solutions for Lidar

     

    Lidar Solutions in ArcGIS_part 1: Assessing Lidar Coverage and Sample Density

    One basic QA/QC process is to ensure the Lidar points delivered by your data provider have the coverage and density expected. You want to catch problems with this early on and have them resolved before continuing. Two geoprocessing tools are useful in this regard: Point File Information found in the 3D Analyst toolbox and Point To Raster located in core Conversion Tools.

    Point File Information
    The Point File Information tool reports basic statistics about one or more point data files on disk. The tool’s primary purpose is to help you review and summarize the data before loading it into your geodatabase.  LAS (the industry standard format for Lidar data) and ASCII format files are supported as input. Since Lidar projects often utilize collections of data files, sometimes in the hundreds or even thousands, the tool lets you specify folder names in addition to individual files. When given a folder, it reads all files inside it that have the suffix you specify.

     

    For each input point file it outputs one polygon with accompanying attribution to a target feature class. The polygon graphically depicts the xy extent, or bounding box, of the data in the file. Attributes include file name, point count, z-min, z-max, and point spacing.

     


    The point spacing reported by Point File Information is not exact and deserves some discussion. For the sake of performance it uses a rough estimate that simply compares the area of the file’s bounding box with the point count. It’s most accurate when the rectangular extent of the file being examined is filled with data. So, files with significant numbers of points excluded over large water bodies or on the perimeter of a study area, only partially occupied with data, will not have accurate estimates. Therefore, the reported point spacing is more meaningful as a summary when looking at trends for collections of files. Something useful to do with the output feature class is to display it in ArcMap, open its attribute table, and sort the point spacing field in ascending order. You can also symbolize on the point spacing field using a graduated color ramp.


     

    Point File Information works quickly on LAS files because it only needs to scan their headers to obtain the information it’s looking for. It takes significantly longer with ASCII files because with them the tool actually has to read all the data.

    Assuming everything checks out OK, the next thing to do is load your Lidar points into a multipoint feature class with the LAS To Multipoint or ASCII 3D To Feature Class tools. Put this feature class in a feature dataset if you intend to build a terrain dataset from the points. While you have the choice between using LAS or ASCII format files, LAS is generally a better way to go. They contain more information and, being binary, can be read by the importer more efficiently.

    Once the points are loaded into a multipoint feature class you can use the Point to Raster tool to get a more in-depth view of the point distribution.

    Point to Raster
    The Point to Raster tool creates rasters from points and it also supports multipoints. It’s a generic tool with many options and uses. For the sake of evaluating Lidar point density the tool’s COUNT option is the thing to go for. This uses the number of points falling in a raster cell as the cell value. Being able to look at this graphically over the extent of the project area is revealing.

    There’re a couple parameters on the Point to Raster tool whose values for this exercise aren’t obvious. First, is the Value Field parameter. It doesn’t matter what this is set to. That’s because the Value Field is ignored when the Cell Assignment type is set to COUNT. Then there’s the cellsize. You might think the average point spacing is good but this typically results in too many empty, or NoData, cells because Lidar points just aren’t that evenly spaced. Also, the output raster could end up being unnecessarily large. Instead, it’s better to go with a cellsize that’s several times larger than the average point spacing but small enough to identify gaps or voids that warrant further investigation. A reasonable size is four times the point spacing. As an example, let’s say your data is sampled at 1 meter. If you set the cellsize to 4 then you can expect, on average, to get 16 points in a cell.


    You can also evaluate the density for different types of points. While most of the time you’ll probably just check the density for all returns it can be useful to look at those that fall in a certain class like ‘ground’. For example, this can give you an idea of how good your ground penetration is in vegetated areas. The Point to Raster tool doesn’t know how to make the distinction between point types though. So, you control what points get used by how you go about creating the multipoint feature class with the LAS To Multipoint tool. It provides options for loading points by class code and return number.

    Once your raster has been created have a look at it in ArcMap. Use a color ramp renderer to display it so it’s easy to distinguish between cells with high counts and those with low. You can also set the NoData color to something that stands out. Look for variance in density and data voids. Have your vendor explain anything that doesn’t look right.


    Hopefully, you’ll find your data meets specifications and lacks surprises. It’s worth the effort to check.

    That’s it for this installment of Lidar Solutions in ArcGIS. Subscribe to this blog or check back in a couple weeks for a discussion on the creation of raster DEMs/DSMs from Lidar.

     

  • Tips and tricks - Unix, Python, and Geoprocessing

    This posting was written by Mark Zollinger, a Product Engineer and long time UNIX user with the Geoprocessing team.

    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)

    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.

    There are several approaches to GIS development that work very well on Solaris and Linux.

    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.

    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.

    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.

    Setting up

    "Okay", you ask, "How do I start writing GP code in Python on non-Windows platforms?"

    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).

    Setting up an IDE that you can use

    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.

    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:

    http://archive.eclipse.org/eclipse/downloads/

    To install Eclipse, follow the instructions in the "Installing Eclipse" paragraph at:

    http://wiki.eclipse.org/FAQ_Where_do_I_get_and_install_Eclipse%3F

    (These instructions are for Ganymede, but they basically the same for version 3.3.2)

    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.

    http://pydev.sourceforge.net/

    Note that you need the Open Source Pydev plugin. The Pydev Extensions plugin is commercial trialware, and is optional.

    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:

    $ARCGISHOME/python25/bin/python

    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:

    ld.so.1: python: fatal: libpython2.5.so.1.0: open failed: No such file or directory

    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.

    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.

    Writing a Python script that does GP stuff

    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:

    import arcgisscripting
    import os, sys

    To access GP, we need to create a Geoprocessor object. This is the object through which you will call any GP functions or objects

    gp = arcgisscripting.create(9.3)

    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.

    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.

    gp.workspace = os.path.join (sys.path[0], "data")
    print "GP Workspace = " + gp.workspace

    (Of course you can set the workspace to any accessible directory, not just the one returned by sys.path[0]. I'm just using sys.path[0] because I know it's accessible.)

    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 -> Run As -> Python Run), you should see "GP Workspace= /some/path/data" printed in the Console tab near the bottom of the Eclipse window.

    You can use Eclipse or the operating system to create the data directory, since it probably doesn't exist yet.

    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.

    Once you have copied your data into the aforementioned data directory, your script could execute the clip tool like this:

    gp.clip_analysis("nat_for.gdb/hawk_sightings", "study_area.shp", "nat_for.gdb/study_sightings")

    Just to be sure it worked, you can print out the messages that the tool generated like this:

    print (gp.getmessages())

    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.

      - You can escape them: "\\some\\path"
      - You can use raw strings: r"\some\path"
      - You can use unicode strings: u"\some\path"

    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.

    So now you have a script that looks like this:

    import arcgisscripting
    import os, sys

    gp = arcgisscripting.create(9.3)

    gp.workspace = os.path.join (sys.path[0], "data")
    print "GP Workspace = " + gp.workspace

    gp.clip_analysis("nat_for.gdb/hawk_sightings", "study_area.shp", "nat_for.gdb/study_sightings")
    print (gp.getmessages())

    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.

    Welcome to the world of Geoprocessing with Python!

    Links

    Automating workflows with scripts - Introduction to writing Python scripts for geoprocessing
    Techniques for sharing Python scripts - Useful techniques for sharing Python scripts
    The Python Tutorial - If you're new to Python, this is a good tutorial to start
    How to duplicate AML functions in Python - For AML programmers
    How to duplicate AML directives in Python- For AML programmers

    Troubleshooting

    Color issues

    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.

    init_engine

    You should have your Engine environment already established in the shell in which you start Eclipse. (source init_engine.sh or source init_engine.csh) If you see inexplicable error messages, this is the most likely cause.

  • Send us your feedback

    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.

    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.

     

     

  • New at 9.3 - Spatial Analyst improvements

    The Spatial Analyst at 9.3 has several new capabilities, improvements, and fixes. This post highlights some of the important changes; for a full description, see the What's New pdf document (Once open, in the Extensions section click on Spatial Analyst. This will take you to the right location in the document.)

    New Functionality

    Zonal Histogram - Helps you to investigate the distribution of cells from one dataset within classes of another. Example applications include rainfall within watersheds or crime distribution by police beat.

     

    Contour with Barriers - This tool allows you to get better results when trying to contour discontinuous surfaces. In addition to its superior handling of barriers, Contour with Barriers creates smoother contour lines, generate much larger output datasets (no 2.14 GB shapefile size limit), and optionally to attribute primary and index contour lines.

     

    The Snap Raster environment has moved from being part of the Extent environment to being its own separate environment setting. This gives you flexibility to set the snap raster dynamically from scripting or ModelBuilder.

    Usability Improvements

    The Con tool now allows the input conditional raster to be a floating point raster.

    The Create Constant Raster, Create Normal Raster, Create Random RasterExtract by Rectangle, and Topo to Raster tools now allow you to specify the extent of the output raster to be that of an existing dataset. The main benefit of this is the extent can be set dynamically from scripting or ModelBuilder. While you can still enter the extent values manually (but who wants to type in 370803.47263702 3978856.7539477 443868.87614745 4032133.0258861 ?), being able to specify a dataset is both easier and helps ensure the proper precision is maintained .

    All Spatial Analyst tools have new Geoprocessing tool errors and warnings and show execution percent complete using the new progress bar.

    Performance and Data Improvements

    Combine and Cut/Fill are significantly faster (up to 40 times).

    Viewshed now handles much larger inputs (no more MSEEK fatal errors!).

    IDW now works with many more points (up to 50 million).

    Combine now works on millions of combinations.

  • Understanding Geostatistical Analyst Layers

    The Geostatistical Analyst (GA for short) uses sample points taken at different locations in a landscape and creates (interpolates) a continuous surface. The sample points are measurements of some phenomenon, such as radiation leaking from a nuclear power plant, an oil spill, or elevation heights. Geostatistical Analyst derives a surface using the values from the measured locations to predict values for each location in the landscape.

    The results of an analysis using GA are saved to a geostatistical layer (GA layer for short), illustrated below. A GA layer is like any ArcMap layer; you add, remove, rename, and alter its symbology in countless ways.

     

    GA layers store the source data (typically point features) and the parameters used to interpolate values, but do not store the full result of the interpolation. When a GA layer is drawn in ArcMap, a coarse grid is placed over the whole extent of the layer and values are interpolated on-the-fly for each cell in the grid. These interpolated values are used to create the filled isolines displayed by the layer. These isolines are only produced for 10 classes that fall between the min and max values of the source data. The resolution of the grid is optimized so as to speed up the drawing of the layer; using a finer grid would cripple drawing speed. (Note: when deemed necessary, the drawing algorithm uses a finer resolution grid to interpolate values in complex areas.)

    The fact that a GA layer interpolates values on-the-fly is sometimes a source of confusion. For example, when a GA layer is exported to a grid using the GA Layer to Grid tool, interpolation is performed for each cell of the output grid. If your output grid has 1000 rows and 1000 columns, one million calculations are performed. (In contrast, the grid used to draw a GA layer may be 100 rows and 100 columns). Fine resolution output grids may require several billion calculations. Obviously, the performance of the GA Layer to Grid tool depends on the resolution of the output grid.

    There is another effect of exporting the layer to a grid — the output cell values, and therefore the min and max values of the output grid, can be affected by the grid's cell size. The min and max values of the grid are almost always different from the min and max values of the input data. For example, the illustration below shows a GA layer with its min and max values and the exported grid with its min and max values. Note both the visual and statistical difference between the min and max values of the two displays.


    Exact interpolators, such as Inverse Distance Weighting, can produce an output grid that has a max value that is less than the input data's max value, as illustrated above. This happens when the input point containing the max value does not fall in the exact center of an output grid cell. In such cases, the max value is weighted according to the distance from the cell center as well as nearby points.

    Suggested readings

    Understanding Geostatistical Analysis

    What is a Geostatistical Layer?

    Knowledge Base Articles

    Geostatistical Analyst Forum


  • Tips and Tricks - Creating ArcSDE connection files on the fly using Python and ArcObjects

    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.

    The attached .zip file (download .zip file) 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:

    E:\SDE Conn sample (incorrect - contains spaces)
    E:\SDEConnectionSample (correct - no spaces)

    Java must be installed

    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 java.com.

    Setting JAVA_HOME

    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.

    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, JAVA_HOME = C:\Program Files\Java\jre1.6.0_07)

    About CreateSDEConnFile.py Python script

    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 An overview of creating script tools in the web help for more information about creating script tools.)

    Arguments to the CreateSDEConnFile java class

    String sConFileDir = args[0]; //Folder path to store the .sde file.
    String sConFile = args[1]; //.sde file name. include the .sde extension.
    pConnProps.setProperty("SERVER", args[2]); //ArcSDE Server name.
    pConnProps.setProperty("INSTANCE", args[3]); //ArcSDE port number.
    pConnProps.setProperty("USER", args[4]); //ArcSDE user name.
    pConnProps.setProperty("PASSWORD", args[5]); //ArcSDE password.
    pConnProps.setProperty("VERSION", args[6]); //Version to connect to.
    pConnProps.setProperty("DATABASE", args[7]); //Database to connect to.

    zip file

    Download zip file

  • Watch ESRI TV

    Check out http://www.youtube.com/esritv.  It contains over 50 videos on a variety of ArcGIS subjects.  Content is updated periodically.  You can also access the videos on Viddler: http://www.viddler.com/explore/esri
  • New at 9.3 - Error reporting

    Check out this Geodatabase blog entry on error reporting.  It describes how we use error reports you submit to improve ArcGIS.  The blog entry has a link to a short video from the 2008 User Conference that is worth watching.
  • Digging deeper - Troubleshooting geoprocessing errors when using ArcSDE data

    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 Understanding geoprocessing tool errors and warnings for more details.

    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:

    ERROR 000210: Cannot create output E:\Infra\ToolData\Connection to ArcSDE.sde\ken.cities

    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.  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.

    Test the connection

    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.  Right-click the connection and select Connection Properties.  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.

     

    If everything seems correct with your connection file, the next investigation step is to set up a client-side SDEINTERCEPT.

    Client-side SDEINTERCEPT

    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 The dbinit.sde file

    (For a more general introduction to configuring ArcSDE geodatabases, see An Overview of configuring an ArcSDE geodatabase .)

    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:

    1. Set the following system environment variables:

      SDEINTERCEPT=crwft
      SDEINTERCEPTLOC=<folder name>

    <folder name> 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\)

    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.

     

    2. Restart the application that will run the geoprocessing tool (such as ArcMap) so that it inherits the new system environment.

    3. Run the geoprocessing tool or script that caused the failure.

    After the task is run, a file named se_intercept.<nnn> is created in the folder specified in the SDEINTERCEPTLOC variable (where <nnn> 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.

    ArcSDE Server error logs

    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.  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.

    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\<sde_instance_name>.log, such as sde_esri_sde.log).

    To have more detailed information in the ArcSDE Server error logs, see the SDEVERBOSE setting in the topic The dbinit.sde file

    DBMS logs and trace files

    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.

    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.

    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.

  • Tips and Tricks - Debugging Python script tools

    If you create your own script tools using Python, you'll appreciate these tips and tricks on debugging.

    Coding errors are inevitable and there are two basic ways to find out where the error occurred:

      - Add some form of print statements to your code that help you isolate the problem.
      - Use an interactive debugger.

    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:

    import arcgisscripting, win32ui, win32con
    gp = arcgisscripting.create()
    n = 5

    # Print message to progress dialog
    #
    gp.AddMessage("Value of n = " + str(n))

    # Issue a popup dialog with OK and Cancel button
    #
    val = win32ui.MessageBox("Value of n = " + str(n), "title", win32con.MB_OKCANCEL)

    # Based on the button clicked, you can branch execution
    #
    if val == 1:
    gp.AddMessage("You clicked OK")
    else:
    gp.AddError("You clicked Cancel")
    raise arcgisscripting.ExecuteError, "Execution stops due to Cancel button click"

    gp.AddMessage("This statement reached")

    The other method is to use a Python IDE (Integrated Development Environment) that supports debugging, such as:

      - Python IDE that is installed with Python
      - PythonWin, available on the web at https://sourceforge.net/projects/pywin32
      - Commercial systems, such as Wing IDE (http://wingware.com)

    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.  The illustration below shows how to use debug mode in PythonWin.

     

    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.

    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,  described below.

    Use GetParameterAsText()

    The first step is to modify your script so that it used GetParameterAsText() instead of sys.argv[], as discussed in Understanding script tool parameters

    This is a modification you can keep - there is no need to change your code back to using sys.argv[].

    Create a .bat file that launches your IDE with your .py as an argument

    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.

     

    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.

    Python IDLE
    "C:\Python25\pythonw.exe" "C:\Python25\Lib\idlelib\idle.pyw" "C:\mytools\myscript.py"

    PythonWin
    "C:\Python25\Lib\site-packages\pythonwin\Pythonwin.exe" "C:\mytools\myscript.py"

    Wing IDE 2.1
    "C:\Program Files\Wing IDE 2.1\bin\wing.exe" "C:\mytools\myscript.py"

    Reset script tool path to the .bat file

    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.


     

    Execute and debug your tool

    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().

    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.

    Reset the script tool source

    Once you have fixed your bugs, you can reset the source to the script file from the .bat file back to the .py file.


    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.

  • Conference proceedings available

    The 2008 User Conference proceedings are available:

    http://events.esri.com/uc/2008/proceedingsCD/index.html

    The proceedings include all professional papers, technical workshop presentations, and GIS & Industry presentations.

  • Thank you so much from the Geoprocessing and Analysis Team

    ...to Everyone who visited us at the Spatial Analysis Island and attended our Tech Workshops and Island Demos. We do hope you recovered from San Diego and are excited about the new things you learned, the answers you got to your questions, and together all will make your work much easier and more fun.

    As always, we also learned a lot from you, about what you like, or don’t like, or want us to do in the future. This is a very special time for us to live vicariously through the great work you have done on top of our work, and understand how to better support you.

    Since you’re here, you heard about the just launched Resource Centers, the new gateway to all ESRI online resources. Here’s the link to ours http://resources.esri.com/Geoprocessing/ . Add it to your Favorites and visit the site often, especially the Geoprocessing Blog and the Model and Scripts Gallery [both under Community]. The Model and Script Gallery on the Geoprocessing Resource Center is a bit different from the other resource centers, in that it's not just us posting things, we're inviting you to post your work as well. Whether that be generic utilities or complete workflows for a specific task, if you think it can be useful for someone else, feel free to share it. I talked with several of the more prominent ArcScripts contributors from the past, who are pretty excited about having a more interactive place to post their work and communicate with their users. We have guidelines for submission, which include documentation of your model and script. When putting the documentation together, make sure you include any use limitations/restrictions – such as if it relies on an ArcInfo or extension licensed tool.

    Regarding writing scripts, we saw noticeable increase in the number and depth of Python questions at the island this year. Actually, there were a lot of great questions and interesting problems to solve at the island, that have us pretty excited about some things we’ll be doing in future releases that will create a richer Python experience in ArcGIS for you (more on that in the future).

    On the other end of the spectrum, we met a lot of new people at the Spatial Analysis Island this year who were attending their first International User Conference, and some who were quite new to the software. For many of them, the team enjoyed demoing ModelBuilder and showing them how to automate their daily routine. It was especially rewarding for those of us who had the chance to introduce many of you to ModelBuilder and hear you say: “Wow, ... I’m gonna use that every day.”

    From the more experienced ModelBuilder users, there were quite a few posters with some very sophisticated models. We’ll be reprinting a few of these to decorate the halls around our new offices. Thanks for the nice work.

    From the analytical side of the conference, all the interest seemed to be on statistics. Our sessions on spatial statistics, regression, and statistical analysis with Spatial Analyst were generally packed, and lots of in depth discussions at the island on applications of these tools as well as Geostatistical Analyst, and integration with 3rd party statistical packages. We’ll be posting some samples to the Model and Script Gallery in the near future and working on some webcasts to share more about current capabilities and applications.

    We hope you got as much out of the conference as we did, and look forward to interacting with you via the Resource Center until we meet again next year.

    Stay tuned…

    The Geoprocessing Team

  • New at 9.3 - Top Ten

    We asked the team to give us their Top 10 New Geoprocessing Features in ArcGIS 9.3. 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.

    In no particular order, here's the first top 10 list.

    Join Field tool

    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.


    See the Join Field  tool reference page for more information.

    Error messages

    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.

     

    See Understanding geoprocessing tool errors and warnings for more information 

    Near with lines and polygons

    Have you ever been required to find the nearest distances between a mixture of point, line, and polygon features?  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 Near tool is improved to support all feature types.  In addition, multiple near feature classes can be supplied.

    Generate Near Table tool

    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 Generate Near Table tool. 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 all features, not just the nearest.

    Performance improvement using ArcSDE data with GpTools

    We've made three major improvements when using ArcSDE data with geoprocessing tools:

      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).

      The performance of the Append tool has improved because the spatial index of the output dataset is created only once instead of many times.

      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.

    Python scripts run in process

    In 9.2