Checking to see if a Field Index Exists Using Python (geoprocessing 9.3).
NOTE: I have a post here that shows how to check if a field exists using arcpy in ArcGIS 10.0.
In developing a python script to reload a geodatabase, I wanted to create any necessary indexes.
No problem creating the index, for example:
gp.AddIndex_management(tablename, field, IndexName, "NON_UNIQUE", "NON_ASCENDING") But before creating the index, I wanted to verify that it did not exist. I tried the ever-popular, exists but could not get it to work–either it does not detect indexes or I just never got the fully-qualified name for the index right (ArcSDE using a postgres datastore).
ArcGIS 9.3.1 to ArcSDE 10 Connection Error
We finally installed an instance of ArcSDE 10 today. My first attempt at connecting in ArcCatalog 9.3.1 failed with the following error:
Failed to connect to the specified server.
This release of the GeoDatabase is either invalid or out of date. [Please run the
ArcSDE setup utility using the -o install option.]
DBMS table not found [sde.sde.GDB_Release]
Turns out the solution was simple, this article points out that Service pack 2 is required.
Displaying Node Dangles in Arcedit
Since the name of the blog is Node Dangles, I get several hits daily from searches on ‘Node Dangles’ and I have no information on node dangles. This post is the first in a series to change that.
First let us, by us, I mean ESRI, define what a node dangle is. Their online glossary actually defines a dangling arc, a dangling node is a node (endpoint of an arc) that does the non-connecting mentioned below:
Multiple outputs for Python scripts
Related to my post on how I enable a script to accept parameters from different sources, I also often set up pythons scripts to output information a variety of ways. This is largely due to the fact that some are called by ArcToolbox scripts. Running in ESRI’s domain, these scripts need to send the output through the arcgisscripting object but if you are running the python outside the ArcGIS framework, you can just print.
Zipping a shapefile via ArcToolbox
UPDATE: After receiving a request to modify the code to ignore .lock files, I have an updated to this post.
I’ve received a request on how to use the Zip Shapefile code I posted last week from ArcGIS. Sorry, I did not set the code up to call directly from ArcGIS but only as an illustration of how it can be done.
I have, however, with some minor tweaking, made a version that can added to ArcToolbox.
Launching a Python script with parameters–3 methods.
Since I use python for different tasks, I launch python scripts a variety of ways. Depending on what I am doing, a single script may need to accept parameters from either:
Passed in from an ArcGIS Toolbox Tool. Re-occurring default value. Often used in scheduled processes, a nightly backup, for example. A temporary set of values used in an interactive, debugging session. What I often do is make the parameter interpretation flexible to meet my needs.
Zipping a shapefile using python
UPDATE: After receiving a request to modify the code to ignore .lock files, I have an updated to this post.
One of the tasks I’ve been automating is publishing a weekly data update to a website. The update consists of shapefile. The trouble with shapefiles is they consist of 3 or more files with the same basename but different extensions in the same directory.
Not an overly complicated situation but a common one that ArcGIS does not have a solution out-of-the-box.
X-section Xacto Updated
I just happened to stumble upon an update of a tool to Create Geologic Cross Sections, eXacto Section v. 2.0, that I mentioned in July. Jennifer Carrell at the Illinois Geological Survey wrote this tool. The latest update is from December 8, 2010 and can be downloaded at ESRI’s ArcGIS Resource Center. Our office has used previous versions and finds in very useful in creating cross-sections. I have not tried this latest update.
Example of how to add controls in data grid VB.NET
I have been working on some data entry forms that utilize a DataGrid. Using a PostGres Geodatabase that had domains set on several fields, I could not directly bind to the controls on my dialog. So I am going the round-about way of populating my own comboboxes with valid names and displaying within the DataGrid.
Having not done this previously, I found this example: Example of how to add controls in data grid VB.
ArcMap Copy and Paste Features
Sometimes it seems like I could write the data down by long hand faster than ArcMap can copy & paste features from one feature class to another. geeeeezzz.
44.852994-93.55073