<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>michalisavraam.org blog &#187; geodatabase</title>
	<atom:link href="http://michalisavraam.org/tag/geodatabase/feed/" rel="self" type="application/rss+xml" />
	<link>http://michalisavraam.org</link>
	<description>a spatial web presence</description>
	<lastBuildDate>Mon, 24 May 2010 17:17:47 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>MakeFeatureLayer in Python</title>
		<link>http://michalisavraam.org/2009/06/makefeaturelayer-in-python/</link>
		<comments>http://michalisavraam.org/2009/06/makefeaturelayer-in-python/#comments</comments>
		<pubDate>Fri, 05 Jun 2009 04:11:11 +0000</pubDate>
		<dc:creator>Michalis Avraam</dc:creator>
				<category><![CDATA[GIS* Points]]></category>
		<category><![CDATA[Python Geoprocessing]]></category>
		<category><![CDATA[Python Points]]></category>
		<category><![CDATA[arcgisscripting]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[geodatabase]]></category>
		<category><![CDATA[geoprocessing]]></category>
		<category><![CDATA[MakeFeatureLayer]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[registry fix]]></category>
		<category><![CDATA[solution]]></category>

		<guid isPermaLink="false">http://michalisavraam.org/teaching/36-pygeoprocessing/55-makefeaturelayer-in-python</guid>
		<description><![CDATA[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 [...]


Related posts:<ol><li><a href='http://michalisavraam.org/2009/06/geoprocessing-iteration-with-python/' rel='bookmark' title='Permanent Link: Geoprocessing Iteration with Python'>Geoprocessing Iteration with Python</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>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.<span id="more-17"></span></p>
<p>ESRI apparently recognizes this issue, and has produced a Technical Article for it (<a title="ESRI Technical Article on MakeFeatureLayer" href="http://support.esri.com/index.cfm?fa=knowledgebase.techarticles.articleShow&amp;d=22668">#22668</a>) 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):</p>
<ol>
<li>Read the results of the OD Matrix (origin destination matrix)</li>
<li>When one record is read, do the following:
<ol>
<li> Extract information about source ID and destination ID</li>
<li>Using MakeFeatureLayer with a query, built two layers (one for origins, one for destinations)</li>
<li>Run a network Route solution based on the two files</li>
<li>Store the resulting route into a feature class collecting them all</li>
</ol>
</li>
</ol>
<p>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.</p>
<p>Searching through the excellent <a title="ESRI Support Portal" href="http://support.esri.com/">ESRI Support</a> site,  I found a <a title="Forum posting about MakeFeatureLayer" href="http://forums.esri.com/Thread.asp?c=93&amp;f=1729&amp;t=280014">Forum Posting</a> 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&#8217;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.</p>
<p>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&#8217;t forget that messing with the registry can mess with your operating system.</p>
<ol>
<li>Use regedit and open the <em>HKEY_CURRENT_USER</em> registry entry.</li>
<li>Navigate to the <em>Software</em> key</li>
<li>Expand the <em>ESRI</em> Key</li>
<li>Open the <em>Geodatabase</em> Key (if it does not exist, simply right-click on <em>ESRI</em> and create a new one)</li>
<li>Expand the <em>Settings</em> Key (or create it if not present)</li>
<li>Add a DWORD value called <em>SelectionThreshold</em> if not already present.</li>
<li>Enter a new value, in decimal base, of 5000 (ESRI recommendation, I used 7000 myself)</li>
<li>Close regedit and you are done.</li>
</ol>
<p>I hope someone else finds this useful out there.</p>
Note: There is a rating embedded within this post, please visit this post to rate it.


<p>Related posts:<ol><li><a href='http://michalisavraam.org/2009/06/geoprocessing-iteration-with-python/' rel='bookmark' title='Permanent Link: Geoprocessing Iteration with Python'>Geoprocessing Iteration with Python</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://michalisavraam.org/2009/06/makefeaturelayer-in-python/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
