arcgisscripting
I’ve previously posted python code to check if a field index exists for both ArcGIs 9.3 and ArcGIS 10.0.
Recently I have been working on a process that was using this code but it was not working because it looks for an index with a specific name. It was not working in this case because the name of the indexes was getting incremented as they were being created. For example, I was building an index on the table C5ST, field RelateId ([C5IX].
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).
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.
I recently had the need to calculate the distance from a point (address point) to a polyline (street segment) and wanted to avoid using any additional libraries because it was being done for an external client. Ok, I actually used arcgisscripting for reading the data but that lacked, from what I could tell, the fine-detail granularity of measuring distance between individual geometries.
But since the only spatial operations I needed were to measure the distance between two points and the distance between a point and polyline, I decided to just do it via brute force.