Jun 04

In the many methods present at the Python interface to ArcGIS (Python geoprocessing through the arcgisscripting module), one that is quite useful when processing individual elements on a feature class is called MakeFeaturelayer(). The behavior, while predictable with a small number of runs, can prove problematic when dealing with large datasets.

ESRI apparently recognizes this issue, and has produced a Technical Article for it (#22668) that discusses the issue when people use enterprise geodatabases. I was running up the same problem though myself when dealing with a personal geodatabase (Jet Engine). Here is what I was trying to do (in Python):

  1. Read the results of the OD Matrix (origin destination matrix)
  2. When one record is read, do the following:
    1. Extract information about source ID and destination ID
    2. Using MakeFeatureLayer with a query, built two layers (one for origins, one for destinations)
    3. Run a network Route solution based on the two files
    4. Store the resulting route into a feature class collecting them all

Now, while this may sound simple (and also makes people wonder why ESRI does not give the option of presenting the actual route with the OD Matrix command), there are problems. What I noticed was that the results of MakeFeatureLayer were inconsistent through the loop. Always, when reaching a specific OD Matrix record, the command returned an empty feature layer. This was happening 48 times over my 393 routes, so it was bothering me.

Searching through the excellent ESRI Support site,  I found a Forum Posting describing similar problems, which also referenced Technical Article #22668 (link above). The technical article though mentions that the problem is only exhibited with enterprise level geodatabases (in essense, the memory the command has to store these is limited, so it saves things to the database, which the command isn’t aware of). I thought I should give it a try, and to my amazement, it worked wonders. I used the value they recommended to change and I had only 8 unsolvable routes (6 times less than before!). Increasing the value slightly yielded only 6 unsolvable routes, so this seems promising.

The details on what one is to do are mentioned in the technical article, and recreated here for your convenience. Please remember to backup before these changes, and don’t forget that messing with the registry can mess with your operating system.

  1. Use regedit and open the HKEY_CURRENT_USER registry entry.
  2. Navigate to the Software key
  3. Expand the ESRI Key
  4. Open the Geodatabase Key (if it does not exist, simply right-click on ESRI and create a new one)
  5. Expand the Settings Key (or create it if not present)
  6. Add a DWORD value called SelectionThreshold if not already present.
  7. Enter a new value, in decimal base, of 5000 (ESRI recommendation, I used 7000 myself)
  8. Close regedit and you are done.

I hope someone else finds this useful out there.

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Related posts:

  1. Geoprocessing Iteration with Python
  2. Accessing Geometries using the Geoprocessor (Updated)
  3. Using the geoprocessor’s List* Methods
  4. Understanding the Geoprocessor Programming Model part 3
  5. Python Geoprocessing in ArcGIS 9.2 vs. 9.3

Leave a Reply

preload preload preload
Easy AdSense by Unreal