<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:blogger="http://schemas.google.com/blogger/2008" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" gd:etag="W/&quot;AkQGRXo7fip7ImA9WhBaEU4.&quot;"><id>tag:blogger.com,1999:blog-3309146341357783035</id><updated>2013-05-21T05:12:04.406-07:00</updated><category term="Random" /><category term="matplotlib" /><category term="Python" /><category term="ArcGIS Server" /><category term="ArcGIS 9.4" /><category term="Silverlight 4.0" /><category term="GP Task" /><category term="ArcGIS Online" /><category term="SQL" /><category term="ArcPy" /><category term="ArcPad" /><category term="tablet" /><category term="web adf" /><category term=".Net" /><category term="ArcGIS 10.1" /><category term="WING" /><category term="Oracle" /><category term="Geography" /><category term="Python Add-ins" /><category term="Programming" /><category term="C++" /><category term="Environment" /><category term="Scripting" /><category term="PyDev" /><category term="Links" /><category term="Humor" /><category term="Windows 2008" /><category term="vbscript" /><category term="GIS Data" /><category term="Computer Mysticism" /><category term="Updates" /><category term="ToolValidator" /><category term="SharePoint 2010" /><category term="AGX1200" /><category term="Nook" /><category term="PythonWin" /><category term="Visual Studios" /><category term="numpy" /><category term="Install" /><category term="Table" /><category term="ArcObjects" /><category term="AGX900" /><category term="holidays" /><category term="Soapbox" /><category term="Sharepoint" /><category term="HTML" /><category term="OOP" /><category term="ArcGIS 10" /><category term="Silverlight" /><title>Another GIS Blog</title><subtitle type="html">Python, .NET, C++, GIS, and Computer Mysticism</subtitle><link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://anothergisblog.blogspot.com/feeds/posts/default" /><link rel="alternate" type="text/html" href="http://anothergisblog.blogspot.com/" /><link rel="next" type="application/atom+xml" href="http://www.blogger.com/feeds/3309146341357783035/posts/default?start-index=26&amp;max-results=25&amp;redirect=false&amp;v=2" /><author><name>Andrew</name><uri>http://www.blogger.com/profile/16991441455885757621</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><generator version="7.00" uri="http://www.blogger.com">Blogger</generator><openSearch:totalResults>241</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/AnotherGisBlog" /><feedburner:info uri="anothergisblog" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><entry gd:etag="W/&quot;CkIASH0yeCp7ImA9WhBbEU0.&quot;"><id>tag:blogger.com,1999:blog-3309146341357783035.post-2467978889026490900</id><published>2013-05-09T04:55:00.001-07:00</published><updated>2013-05-09T04:55:49.390-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-05-09T04:55:49.390-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Python" /><category scheme="http://www.blogger.com/atom/ns#" term="ArcPy" /><category scheme="http://www.blogger.com/atom/ns#" term="ArcGIS 10.1" /><title>How to Create a Row with an Empty BLOB in ArcPy</title><content type="html">Insert and Update cursor do now support None type in Blob fields, so what does one do? &amp;nbsp;If you try to set your row object to 'None' you get this error message:&lt;br /&gt;
&lt;blockquote class="tr_bq"&gt;
&lt;i&gt;expected contiguous memoryview. type: NoneType&lt;/i&gt;&lt;/blockquote&gt;
Now let's assume you want to pass None, because for some record you do not have an object that you need to pass for that field. &amp;nbsp;Use the Memoryview object to solve this problem. &amp;nbsp;The documentation on the object can be found &lt;a href="http://docs.python.org/2/c-api/buffer.html" target="_blank"&gt;here&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
The python document describe the object as such:&lt;br /&gt;
&lt;blockquote class="tr_bq"&gt;
&lt;i&gt;A memoryview object exposes the new C level buffer interface as a Python object which can then be passed around like any other object.&lt;/i&gt;&lt;/blockquote&gt;
Now in our context, we must do the following:&lt;br /&gt;
&lt;blockquote class="tr_bq"&gt;
row[0] = memoryview('')&lt;/blockquote&gt;
That's it. Now we have something similar to 'None' for your blob field.&lt;br /&gt;
&lt;br /&gt;
I also posted a quick tutorial on read/writing blob data using arcpy.da &lt;a href="http://anothergisblog.blogspot.com/2012/06/working-with-blob-data-at-101-arcpyda.html" target="_blank"&gt;here&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Please support this idea of having GUI designer in python built in with python add-ins.&lt;br /&gt;
&lt;div&gt;
It can be found&amp;nbsp;&lt;a href="http://ideas.arcgis.com/ideaView?id=087E00000004SmHIAU" target="_blank"&gt;here&lt;/a&gt;. (direct link: http://ideas.arcgis.com/ideaView?id=087E00000004SmHIAU)&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
Enjoy&lt;div class="blogger-post-footer"&gt;Copyright AJC&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/AnotherGisBlog/~4/DrSNMfl8Kyk" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://anothergisblog.blogspot.com/feeds/2467978889026490900/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=3309146341357783035&amp;postID=2467978889026490900&amp;isPopup=true" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3309146341357783035/posts/default/2467978889026490900?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3309146341357783035/posts/default/2467978889026490900?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AnotherGisBlog/~3/DrSNMfl8Kyk/how-to-create-row-with-empty-blob-in.html" title="How to Create a Row with an Empty BLOB in ArcPy" /><author><name>Andrew</name><uri>http://www.blogger.com/profile/16991441455885757621</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>1</thr:total><feedburner:origLink>http://anothergisblog.blogspot.com/2013/05/how-to-create-row-with-empty-blob-in.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DEINQHg7cCp7ImA9WhBVGUo.&quot;"><id>tag:blogger.com,1999:blog-3309146341357783035.post-185555838090935865</id><published>2013-04-26T04:42:00.001-07:00</published><updated>2013-04-26T04:43:11.608-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-04-26T04:43:11.608-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Python" /><category scheme="http://www.blogger.com/atom/ns#" term="numpy" /><category scheme="http://www.blogger.com/atom/ns#" term="ArcPy" /><category scheme="http://www.blogger.com/atom/ns#" term="ArcGIS 10.1" /><title>Working with numpy's Structured Array and numpy.dtype</title><content type="html">In my previous &lt;a href="http://anothergisblog.blogspot.com/2013/04/using-pyodbc-to-connect-to-access-with.html" target="_blank"&gt;post&lt;/a&gt;, I showed how to quickly get access data (2007/2010) into a file geodatabase without creating an ODBC connection in ArcCatalog/Map using pyODBC. &amp;nbsp;You might have noticed that I used numpy to create a table pretty easily, but you might be wondering what are the dtypes?&lt;br /&gt;
&lt;br /&gt;
numpy.dtype are data type objects that describe how the bytes in a fixed-size block of memory are seen by the system. &amp;nbsp;So is the data a string, number, etc... &amp;nbsp;It describes the follow aspects of data:&lt;br /&gt;
&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;Type of data (integer, float, object, ...)&lt;/li&gt;
&lt;li&gt;size of data (number of bytes)&lt;/li&gt;
&lt;li&gt;describes an array of data&lt;/li&gt;
&lt;li&gt;names of fields in the record&lt;/li&gt;
&lt;li&gt;if the data is a sub-array, it's shape&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;
Getting the dtype formats for common python data types if fairly easy in python. The numpy.dtype() will return the proper format for almost any python data type:&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;pre class="bbcode_code" style="background-color: #f2f6f8; background-repeat: repeat no-repeat; border: 1px inset; color: #333333; direction: ltr; font-family: 'Courier New', Courier, monospace !important; font-size: 12px; line-height: 12px; overflow: scroll; padding: 6px;"&gt;&amp;gt;&amp;gt;&amp;gt; print numpy.dtype(str)
|S0
&lt;/pre&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
For array protocol type strings, there are various data types supported:&lt;br /&gt;
&lt;br /&gt;
&lt;table border="1" class="docutils" style="background-color: white; border-collapse: collapse; border: 0px; color: black; font-family: sans-serif; font-size: 16px;"&gt;&lt;colgroup&gt;&lt;col width="40%"&gt;&lt;/col&gt;&lt;col width="60%"&gt;&lt;/col&gt;&lt;/colgroup&gt;&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-width: 0px 0px 1px; padding: 1px 8px 1px 5px;"&gt;&lt;tt class="docutils literal" style="background-color: #ecf0f3; font-size: 0.95em; padding: 0px 1px;"&gt;&lt;span class="pre"&gt;'b'&lt;/span&gt;&lt;/tt&gt;&lt;/td&gt;&lt;td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-width: 0px 0px 1px; padding: 1px 8px 1px 5px;"&gt;Boolean&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-width: 0px 0px 1px; padding: 1px 8px 1px 5px;"&gt;&lt;tt class="docutils literal" style="background-color: #ecf0f3; font-size: 0.95em; padding: 0px 1px;"&gt;&lt;span class="pre"&gt;'i'&lt;/span&gt;&lt;/tt&gt;&lt;/td&gt;&lt;td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-width: 0px 0px 1px; padding: 1px 8px 1px 5px;"&gt;(signed) integer&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-width: 0px 0px 1px; padding: 1px 8px 1px 5px;"&gt;&lt;tt class="docutils literal" style="background-color: #ecf0f3; font-size: 0.95em; padding: 0px 1px;"&gt;&lt;span class="pre"&gt;'u'&lt;/span&gt;&lt;/tt&gt;&lt;/td&gt;&lt;td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-width: 0px 0px 1px; padding: 1px 8px 1px 5px;"&gt;unsigned integer&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-width: 0px 0px 1px; padding: 1px 8px 1px 5px;"&gt;&lt;tt class="docutils literal" style="background-color: #ecf0f3; font-size: 0.95em; padding: 0px 1px;"&gt;&lt;span class="pre"&gt;'f'&lt;/span&gt;&lt;/tt&gt;&lt;/td&gt;&lt;td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-width: 0px 0px 1px; padding: 1px 8px 1px 5px;"&gt;floating-point&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-width: 0px 0px 1px; padding: 1px 8px 1px 5px;"&gt;&lt;tt class="docutils literal" style="background-color: #ecf0f3; font-size: 0.95em; padding: 0px 1px;"&gt;&lt;span class="pre"&gt;'c'&lt;/span&gt;&lt;/tt&gt;&lt;/td&gt;&lt;td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-width: 0px 0px 1px; padding: 1px 8px 1px 5px;"&gt;complex-floating point&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-width: 0px 0px 1px; padding: 1px 8px 1px 5px;"&gt;&lt;tt class="docutils literal" style="background-color: #ecf0f3; font-size: 0.95em; padding: 0px 1px;"&gt;&lt;span class="pre"&gt;'S'&lt;/span&gt;&lt;/tt&gt;,&amp;nbsp;&lt;tt class="docutils literal" style="background-color: #ecf0f3; font-size: 0.95em; padding: 0px 1px;"&gt;&lt;span class="pre"&gt;'a'&lt;/span&gt;&lt;/tt&gt;&lt;/td&gt;&lt;td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-width: 0px 0px 1px; padding: 1px 8px 1px 5px;"&gt;string&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-width: 0px 0px 1px; padding: 1px 8px 1px 5px;"&gt;&lt;tt class="docutils literal" style="background-color: #ecf0f3; font-size: 0.95em; padding: 0px 1px;"&gt;&lt;span class="pre"&gt;'U'&lt;/span&gt;&lt;/tt&gt;&lt;/td&gt;&lt;td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-width: 0px 0px 1px; padding: 1px 8px 1px 5px;"&gt;unicode&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-width: 0px 0px 1px; padding: 1px 8px 1px 5px;"&gt;&lt;tt class="docutils literal" style="background-color: #ecf0f3; font-size: 0.95em; padding: 0px 1px;"&gt;&lt;span class="pre"&gt;'V'&lt;/span&gt;&lt;/tt&gt;&lt;/td&gt;&lt;td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-width: 0px 0px 1px; padding: 1px 8px 1px 5px;"&gt;anything (&lt;tt class="xref py py-class docutils literal" style="background-color: transparent; font-size: 0.95em; font-weight: bold; padding: 0px 1px;"&gt;&lt;span class="pre"&gt;void&lt;/span&gt;&lt;/tt&gt;)&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
(source: numpy help documents)&lt;br /&gt;
&lt;br /&gt;
This allows you to specify thing like string length. &lt;br /&gt;
Example:&lt;br /&gt;
&lt;pre class="bbcode_code" style="background-color: #f2f6f8; background-repeat: repeat no-repeat; border: 1px inset; color: #333333; direction: ltr; font-family: 'Courier New', Courier, monospace !important; font-size: 12px; line-height: 12px; overflow: scroll; padding: 6px;"&gt;&amp;gt;&amp;gt;&amp;gt; dt = numpy.dtype('a25')  # 25-character string
&lt;/pre&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
After you know what your data types are, you will want to associate these types with the fields in the records. &amp;nbsp;I prefer to use the optional dictionary method where there are two keys: 'names' and 'formats'. &amp;nbsp;You would then pass this information to create your 'structured array'. &lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="bbcode_code" style="background-color: #f2f6f8; background-repeat: repeat no-repeat; border: 1px inset; color: #333333; direction: ltr; font-family: 'Courier New', Courier, monospace !important; font-size: 12px; line-height: 12px; overflow: scroll; padding: 6px;"&gt;&amp;gt;&amp;gt;&amp;gt; dt = numpy.dtype({'names': ['r','g','b','a'],

&amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;    &lt;/span&gt;'formats': [numpy.uint8, numpy.uint8, numpy.uint8, numpy.uint8]})

&amp;gt;&amp;gt;&amp;gt; colors = numpy.zeros(5, dtype = dt)

&amp;gt;&amp;gt;&amp;gt; print colors

[(0, 0, 0, 0) (0, 0, 0, 0) (0, 0, 0, 0) (0, 0, 0, 0) (0, 0, 0, 0)]

&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There are many ways to declare dtypes for your data, and you can read them all &lt;a href="http://docs.scipy.org/doc/numpy-1.6.0/reference/arrays.dtypes.html" target="_blank"&gt;here&lt;/a&gt;.&lt;br /&gt;
More on structured arrays in numpy can be found &lt;a href="http://docs.scipy.org/doc/numpy/user/basics.rec.html" target="_blank"&gt;here&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
Enjoy&lt;/div&gt;
&lt;div class="blogger-post-footer"&gt;Copyright AJC&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/AnotherGisBlog/~4/lMoOtRj47Mw" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://anothergisblog.blogspot.com/feeds/185555838090935865/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=3309146341357783035&amp;postID=185555838090935865&amp;isPopup=true" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3309146341357783035/posts/default/185555838090935865?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3309146341357783035/posts/default/185555838090935865?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AnotherGisBlog/~3/lMoOtRj47Mw/working-with-numpys-structured-arraies.html" title="Working with numpy's Structured Array and numpy.dtype" /><author><name>Andrew</name><uri>http://www.blogger.com/profile/16991441455885757621</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://anothergisblog.blogspot.com/2013/04/working-with-numpys-structured-arraies.html</feedburner:origLink></entry><entry gd:etag="W/&quot;Dk8ERXgyfSp7ImA9WhBVGE0.&quot;"><id>tag:blogger.com,1999:blog-3309146341357783035.post-2072955505813340828</id><published>2013-04-24T05:00:00.000-07:00</published><updated>2013-04-24T05:00:04.695-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-04-24T05:00:04.695-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Programming" /><category scheme="http://www.blogger.com/atom/ns#" term="Python" /><category scheme="http://www.blogger.com/atom/ns#" term="ArcGIS 10.1" /><title>Using pyODBC to Connect To Access with ArcPy</title><content type="html">pyODBC allows users to access any data source with the proper ODBC driver installed on the system. &amp;nbsp;This is very convenient, and helpful because at 10.1 using ArcPy only you cannot create ODBC connection. &lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
You can download pyODBC &lt;a href="https://code.google.com/p/pyodbc/" target="_blank"&gt;here&lt;/a&gt;. &amp;nbsp;Grab the correct python version and install it.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Once installed, let's try to access a 2010-2012 MS Access Database.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
I create a dummy database called 'db_text.accdb' and create a table called 'Addresses' with 5 text fields:&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;ol&gt;
&lt;li&gt;name&lt;/li&gt;
&lt;li&gt;street&lt;/li&gt;
&lt;li&gt;town&lt;/li&gt;
&lt;li&gt;country&lt;/li&gt;
&lt;li&gt;zipcode&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;
After that I populated two rows with dummy data. &amp;nbsp;Once you have some dummy data, let's move forward.&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;pre class="bbcode_code" style="background-color: #f2f6f8; background-repeat: repeat no-repeat; border: 1px inset; color: #333333; direction: ltr; font-family: 'Courier New', Courier, monospace !important; font-size: 12px; line-height: 12px; overflow: scroll; padding: 6px;"&gt;import pyodbc

import arcpy

import numpy

arcpy.env.overwriteOutput = True

accb = r"C:\temp\db_test.accdb"
access_con_string = r"Driver={Microsoft Access Driver (*.mdb, *.accdb)};Dbq=%s" % accb
cnxn   = pyodbc.connect(access_con_string)
cursor = cnxn.cursor()
cursor.execute("select * from Addresses")
rows = cursor.fetchall()

dts = {'names': ('ID','name','street', 'town', 'country', 'zipcode'),
       'formats':(numpy.uint8, 'S255','S255','S255','S10','S10')}

array = numpy.rec.fromrecords(rows, dtype=dts)

arcpy.da.NumPyArrayToTable(array, r"c:\temp\scratch.gdb\outTable")&lt;/pre&gt;
&lt;br /&gt;
Here we connected to the MS Access database using the drivers installed on my local system.  Next I performed a simple query to return all records from the table.  With the new da.NumPyArrayToTable() at 10.1, I want to convert the pyodbc rows to a table that can be used in ArcMap.  I convert the list of tuples (rows object) to a numpy.array object.  After the conversion, I fire off the arcpy function and now I have a table on disk.  

&lt;br /&gt;
&lt;br /&gt;
For a complete listing of 10.1 numpy functions, check out:&amp;nbsp;&lt;a href="http://resources.arcgis.com/en/help/main/10.1/index.html#/What_is_the_data_access_module/018w00000008000000/"&gt;http://resources.arcgis.com/en/help/main/10.1/index.html#/What_is_the_data_access_module/018w00000008000000/&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
There you can learn about extending tables, convert feature classes to numpy arrays, and rasters as well.&lt;br /&gt;
&lt;br /&gt;
Enjoy&lt;br /&gt;
&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;Copyright AJC&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/AnotherGisBlog/~4/7B9PMQSthZs" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://anothergisblog.blogspot.com/feeds/2072955505813340828/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=3309146341357783035&amp;postID=2072955505813340828&amp;isPopup=true" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3309146341357783035/posts/default/2072955505813340828?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3309146341357783035/posts/default/2072955505813340828?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AnotherGisBlog/~3/7B9PMQSthZs/using-pyodbc-to-connect-to-access-with.html" title="Using pyODBC to Connect To Access with ArcPy" /><author><name>Andrew</name><uri>http://www.blogger.com/profile/16991441455885757621</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://anothergisblog.blogspot.com/2013/04/using-pyodbc-to-connect-to-access-with.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUUFQ3s8fyp7ImA9WhBVEE8.&quot;"><id>tag:blogger.com,1999:blog-3309146341357783035.post-5395709472085470882</id><published>2013-04-15T05:00:00.000-07:00</published><updated>2013-04-15T05:00:12.577-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-04-15T05:00:12.577-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="ArcPy" /><category scheme="http://www.blogger.com/atom/ns#" term="ArcGIS 10.1" /><title>Dynamic Layers and Workspaces</title><content type="html">An interesting and exciting aspect that I really like at 10.1 is the use of dynamic map services to display data from a work space on disk. &lt;br /&gt;
&lt;br /&gt;
The exciting aspect is this:&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Dynamic&amp;nbsp;Rendering&lt;/li&gt;
&lt;li&gt;Add 1:n layers to a map service&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
Where is gets interesting is this, in ArcPy, you cannot update symbology for feature classes. &amp;nbsp;So essentially if you wanted to add a feature class to a map document, you have to accept the default symbology, or apply the symbology from an already existing set of layer files (.lyr). &amp;nbsp;Not real dynamic, and at least I feel, a horrible choice. &amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Leveraging the &lt;a href="http://resources.arcgis.com/en/help/arcgis-rest-api/#/Web_map_format_overview/02r30000004n000000/" target="_blank"&gt;web map REST&lt;/a&gt; specifications, as a developer you could create a map object (mapping.MapDocument object) and export the display to PNG, PDF, JPG, etc... &amp;nbsp;The downside is that at 10.1, it appears you cannot save the MapDocument object to disk and view the dynamic layer in the TOC. &amp;nbsp;This will throw an error when you open the map document file.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
So what is this good for you are probably thinking? &amp;nbsp;It's true you cannot view dynamic layers in 10.1, but the ability to use dynamic layers gives data driven pages the much needed shot in the arm to add layer on the fly from a web application. &amp;nbsp;The new printing services for ArcGIS for Server leverages this concept except the out of box tool only produces one export at a time, where as a data driven page tool would produce multiple exports from a single input.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
To get this concept to work, you would have to do the following:&lt;/div&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;pre class="bbcode_code" style="background-color: #f2f6f8; background-repeat: repeat no-repeat; border: 1px inset; color: #333333; direction: ltr; font-family: 'Courier New', Courier, monospace !important; font-size: 12px; line-height: 12px; overflow: scroll; padding: 6px;"&gt;import arcpy
&lt;br/&gt;from arcpy import mapping&lt;br/&gt;
json = arcpy.GetParameterAsText(0)&lt;br/&gt;results = mapping.ConvertWebMapToMapDocument(json)&lt;br/&gt;
mxd = results.mapDocument&lt;br/&gt;
mapping.ExportToPDF(mxd, r"c:\temp\export.pdf")&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
Here we created a new map object from a JSON string input and dumped it out to a PDF. &amp;nbsp;(JSON not included here)&lt;br /&gt;
&lt;br /&gt;
ConvertWebMapToMapDocument() has some other very interesting functions/properties. &amp;nbsp;It can incorporate existing map document templates, and even extract Point, Lines and Polygon graphics to feature classes when passed as JSON to the function. &lt;br /&gt;
&lt;br /&gt;
You can find more about ConvertWebMapToMapDocument here:&amp;nbsp;&lt;a href="http://resources.arcgis.com/en/help/main/10.1/index.html#//00s30000006n000000"&gt;http://resources.arcgis.com/en/help/main/10.1/index.html#//00s30000006n000000&lt;/a&gt;. &amp;nbsp;In addition to the function you can also find examples of web map JSON so you can quickly start playing around with the functions. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Please support this idea of having GUI designer in python built in with python add-ins.&lt;br /&gt;
&lt;div&gt;
It can be found &lt;a href="http://ideas.arcgis.com/ideaView?id=087E00000004SmHIAU" target="_blank"&gt;here&lt;/a&gt;. (direct link: http://ideas.arcgis.com/ideaView?id=087E00000004SmHIAU)&lt;br /&gt;
&lt;br /&gt;
Enjoy&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;Copyright AJC&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/AnotherGisBlog/~4/36xwj6j6d9A" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://anothergisblog.blogspot.com/feeds/5395709472085470882/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=3309146341357783035&amp;postID=5395709472085470882&amp;isPopup=true" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3309146341357783035/posts/default/5395709472085470882?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3309146341357783035/posts/default/5395709472085470882?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AnotherGisBlog/~3/36xwj6j6d9A/dynamic-layers-and-workspaces.html" title="Dynamic Layers and Workspaces" /><author><name>Andrew</name><uri>http://www.blogger.com/profile/16991441455885757621</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://anothergisblog.blogspot.com/2013/04/dynamic-layers-and-workspaces.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEMFQXgycSp7ImA9WhBWFE8.&quot;"><id>tag:blogger.com,1999:blog-3309146341357783035.post-3820432228516322881</id><published>2013-04-08T05:00:00.000-07:00</published><updated>2013-04-08T05:00:10.699-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-04-08T05:00:10.699-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Scripting" /><category scheme="http://www.blogger.com/atom/ns#" term="Programming" /><category scheme="http://www.blogger.com/atom/ns#" term="Python" /><title>Great Learning Python Resource</title><content type="html">Hey Everyone,&lt;br /&gt;
&lt;br /&gt;
The Internet is filled with great resources for learning programming, almost too much, but here is a great resource:&amp;nbsp;&lt;a href="http://learnpythonthehardway.org/book/"&gt;http://learnpythonthehardway.org/book/&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
This site hosts a e-book called 'Learn Python The Hard Way' and I highly recommend if you are starting out programming, or want to just a refresher course on python that you take a look. &lt;br /&gt;
&lt;br /&gt;
There are also courses on C, CLI, SQL, Ruby, and Regex.&lt;br /&gt;
&lt;br /&gt;
You might learn something new, so give it a try.&lt;br /&gt;
&lt;br /&gt;
As always, I encourage my reader to please support my idea on the ArcGIS Ideas Site to allow GUI integration with ArcPy. &amp;nbsp;Please vote it up here:&amp;nbsp;&lt;a href="http://ideas.arcgis.com/ideaView?id=087E00000004SmHIAU"&gt;http://ideas.arcgis.com/ideaView?id=087E00000004SmHIAU&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;Enjoy&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;Copyright AJC&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/AnotherGisBlog/~4/RgslMh__HEw" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://anothergisblog.blogspot.com/feeds/3820432228516322881/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=3309146341357783035&amp;postID=3820432228516322881&amp;isPopup=true" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3309146341357783035/posts/default/3820432228516322881?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3309146341357783035/posts/default/3820432228516322881?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AnotherGisBlog/~3/RgslMh__HEw/great-learning-python-resource.html" title="Great Learning Python Resource" /><author><name>Andrew</name><uri>http://www.blogger.com/profile/16991441455885757621</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://anothergisblog.blogspot.com/2013/04/great-learning-python-resource.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0EEQX48eCp7ImA9WhBXFEo.&quot;"><id>tag:blogger.com,1999:blog-3309146341357783035.post-2156654232469661257</id><published>2013-03-28T06:00:00.000-07:00</published><updated>2013-03-28T06:00:00.070-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-03-28T06:00:00.070-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="GP Task" /><category scheme="http://www.blogger.com/atom/ns#" term="Programming" /><category scheme="http://www.blogger.com/atom/ns#" term="ArcGIS 10" /><category scheme="http://www.blogger.com/atom/ns#" term="Python" /><category scheme="http://www.blogger.com/atom/ns#" term="ArcPy" /><category scheme="http://www.blogger.com/atom/ns#" term="Python Add-ins" /><category scheme="http://www.blogger.com/atom/ns#" term="ArcGIS 10.1" /><title>Support GUI Design in ArcGIS for Desktop</title><content type="html">Please support this idea of having GUI designer in python built in with python add-ins.&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
It can be found here:&amp;nbsp;http://ideas.arcgis.com/ideaView?id=087E00000004SmHIAU&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Thanks everyone.&lt;/div&gt;
&lt;div class="blogger-post-footer"&gt;Copyright AJC&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/AnotherGisBlog/~4/yZ7h6e2Kw1o" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://anothergisblog.blogspot.com/feeds/2156654232469661257/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=3309146341357783035&amp;postID=2156654232469661257&amp;isPopup=true" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3309146341357783035/posts/default/2156654232469661257?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3309146341357783035/posts/default/2156654232469661257?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AnotherGisBlog/~3/yZ7h6e2Kw1o/support-gui-design-in-arcgis-for-desktop.html" title="Support GUI Design in ArcGIS for Desktop" /><author><name>Andrew</name><uri>http://www.blogger.com/profile/16991441455885757621</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://anothergisblog.blogspot.com/2013/03/support-gui-design-in-arcgis-for-desktop.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C0QCRHw-eSp7ImA9WhBXFEo.&quot;"><id>tag:blogger.com,1999:blog-3309146341357783035.post-4966748764225003047</id><published>2013-03-27T05:00:00.000-07:00</published><updated>2013-03-28T04:49:25.251-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-03-28T04:49:25.251-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Python" /><category scheme="http://www.blogger.com/atom/ns#" term="ArcPy" /><category scheme="http://www.blogger.com/atom/ns#" term="ArcGIS 10.1" /><title>Creating Data Frame Extents (ArcPy 10.1)</title><content type="html">I read your comments, and thank you for posting them. &amp;nbsp;I was asked how do you clip all layers in a map document by the current data frame's extent.&lt;br /&gt;
&lt;br /&gt;
In a previous post, I discussed &lt;a href="http://anothergisblog.blogspot.com/2011/07/creating-extent-polygons-using-arcpy.html" target="_blank"&gt;how to create extent polygons&lt;/a&gt;&amp;nbsp;for feature classes and individual features. &amp;nbsp;The same method applies for creating an extent polygon using data frames.&lt;br /&gt;
&lt;br /&gt;
The data frame object has a whole host of properties and methods which can be found&lt;a href="http://resources.arcgis.com/en/help/main/10.1/index.html#//00s300000003000000" target="_blank"&gt; here&lt;/a&gt;. &amp;nbsp;To get the extent of a data frame, just reference the extent property to obtain the data frame's current extent. &amp;nbsp;Create the extent polygon or feature class, and clip by the extent geometry.&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;pre class="bbcode_code" style="background-color: #f2f6f8; background-repeat: repeat no-repeat; border: 1px inset; color: #333333; direction: ltr; font-family: 'Courier New', Courier, monospace !important; font-size: 12px; line-height: 12px; overflow: scroll; padding: 6px;"&gt;# Clip layers by extent of data frame (assuming in arcmap session)
import os
import arcpy
from arcpy import env
from arcpy import mapping
mxd = mapping.MapDocument("CURRENT")
df = mxd.activeDataFrame
extent = df.extent&lt;/pre&gt;
&lt;pre class="bbcode_code" style="background-color: #f2f6f8; background-repeat: repeat no-repeat; border: 1px inset; color: #333333; direction: ltr; font-family: 'Courier New', Courier, monospace !important; font-size: 12px; line-height: 12px; overflow: scroll; padding: 6px;"&gt;array = arcpy.Array()
array.add(extent.lowerLeft)
array.add(extent.lowerRight)
array.add(extent.upperRight)
array.add(extent.upperLeft)
array.add(extent.lowerLeft)
polygon = arcpy.Polygon(array, df.spatialReference)
array.removeAll()
del array
for layer in mapping.ListLayers(mxd, data_frame=df):
    clipped_fc = env.scratchGDB + os.sep + layer.datasetName + "_clipped"
    arcpy.Clip_analysis(in_features=layer, 
                        clip_features=polygon,
                        out_feature_class=clipped_fc)
    del layer
del mxd
del df
del extent
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
This code is just a quick re-hash of old concepts applied to a new method.  The extent object creates a polygon, which is used to clip the layers in that data frame.
&lt;div class="blogger-post-footer"&gt;Copyright AJC&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/AnotherGisBlog/~4/3h7NLRMfaTk" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://anothergisblog.blogspot.com/feeds/4966748764225003047/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=3309146341357783035&amp;postID=4966748764225003047&amp;isPopup=true" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3309146341357783035/posts/default/4966748764225003047?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3309146341357783035/posts/default/4966748764225003047?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AnotherGisBlog/~3/3h7NLRMfaTk/creating-data-frame-extents-arcpy-101.html" title="Creating Data Frame Extents (ArcPy 10.1)" /><author><name>Andrew</name><uri>http://www.blogger.com/profile/16991441455885757621</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>2</thr:total><feedburner:origLink>http://anothergisblog.blogspot.com/2013/03/creating-data-frame-extents-arcpy-101.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0YBQns_cCp7ImA9WhBQGUU.&quot;"><id>tag:blogger.com,1999:blog-3309146341357783035.post-3741169423650147096</id><published>2013-03-22T13:45:00.001-07:00</published><updated>2013-03-22T13:45:53.548-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-03-22T13:45:53.548-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Programming" /><category scheme="http://www.blogger.com/atom/ns#" term="C++" /><title>ArcGIS for Developers</title><content type="html">Today I noticed a new site from Esri, and it's called 'ArcGIS for Developers'. &amp;nbsp;This website consolidates the web, mobile, and introduces some new desktop APIs.&lt;br /&gt;
&lt;br /&gt;
The one that really excites me is the Qt API because I'm a fan of C++. &amp;nbsp;I also introduces the new approach to open for Esri by using GitHub for code sharing. &amp;nbsp;I've only started playing, but I'm excited to see what comes.&lt;br /&gt;
&lt;br /&gt;
Check it out here:&amp;nbsp;http://developers.arcgis.com/en/&lt;br /&gt;
&lt;br /&gt;
Happy coding.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;Copyright AJC&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/AnotherGisBlog/~4/SfeqcpepZt4" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://anothergisblog.blogspot.com/feeds/3741169423650147096/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=3309146341357783035&amp;postID=3741169423650147096&amp;isPopup=true" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3309146341357783035/posts/default/3741169423650147096?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3309146341357783035/posts/default/3741169423650147096?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AnotherGisBlog/~3/SfeqcpepZt4/arcgis-for-developers.html" title="ArcGIS for Developers" /><author><name>Andrew</name><uri>http://www.blogger.com/profile/16991441455885757621</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://anothergisblog.blogspot.com/2013/03/arcgis-for-developers.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DEcERns_fip7ImA9WhBQEUo.&quot;"><id>tag:blogger.com,1999:blog-3309146341357783035.post-2065863337291815757</id><published>2013-03-13T05:00:00.000-07:00</published><updated>2013-03-13T05:00:07.546-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-03-13T05:00:07.546-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Programming" /><category scheme="http://www.blogger.com/atom/ns#" term="Python" /><title>The random Module (python)</title><content type="html">The random module is pseudo-random number generator. &amp;nbsp;This means that's truly not random, but close enough. &lt;br /&gt;
&lt;br /&gt;
You should seed, initialize the generator with either a value, or with the system time (default value).&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;pre class="bbcode_code" style="background-color: #f2f6f8; background-repeat: repeat no-repeat; border: 1px inset; color: #333333; direction: ltr; font-family: 'Courier New', Courier, monospace !important; font-size: 12px; line-height: 12px; overflow: scroll; padding: 6px;"&gt;&amp;gt;&amp;gt;&amp;gt; import random
&amp;gt;&amp;gt;&amp;gt; random.seed()
&amp;gt;&amp;gt;&amp;gt; print random.random()
0.884447776659
&amp;gt;&amp;gt;&amp;gt; print random.random()
0.379767969805
&amp;gt;&amp;gt;&amp;gt; print random.random()
0.580327390006&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
Random also has the ability to pick from ranges and collection of elements, like letter:&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;pre class="bbcode_code" style="background-color: #f2f6f8; background-repeat: repeat no-repeat; border: 1px inset; color: #333333; direction: ltr; font-family: 'Courier New', Courier, monospace !important; font-size: 12px; line-height: 12px; overflow: scroll; padding: 6px;"&gt;&amp;gt;&amp;gt;&amp;gt; random.randrange(start=0, stop=101, step=1)
52
&lt;/pre&gt;
&lt;pre class="bbcode_code" style="background-color: #f2f6f8; background-repeat: repeat no-repeat; border: 1px inset; color: #333333; direction: ltr; font-family: 'Courier New', Courier, monospace !important; font-size: 12px; line-height: 12px; overflow: scroll; padding: 6px;"&gt;&amp;gt;&amp;gt;&amp;gt; random.choice('abcdefghij')
'b'&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
Happy Randomness.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;Copyright AJC&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/AnotherGisBlog/~4/z3Jrl5Hc6gA" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://anothergisblog.blogspot.com/feeds/2065863337291815757/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=3309146341357783035&amp;postID=2065863337291815757&amp;isPopup=true" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3309146341357783035/posts/default/2065863337291815757?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3309146341357783035/posts/default/2065863337291815757?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AnotherGisBlog/~3/z3Jrl5Hc6gA/the-random-module-python.html" title="The random Module (python)" /><author><name>Andrew</name><uri>http://www.blogger.com/profile/16991441455885757621</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://anothergisblog.blogspot.com/2013/03/the-random-module-python.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A08HSXc7eyp7ImA9WhBSGEo.&quot;"><id>tag:blogger.com,1999:blog-3309146341357783035.post-3656404742834938430</id><published>2013-02-26T03:55:00.003-08:00</published><updated>2013-02-26T03:57:18.903-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-02-26T03:57:18.903-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="ArcGIS Server" /><category scheme="http://www.blogger.com/atom/ns#" term="ArcPy" /><category scheme="http://www.blogger.com/atom/ns#" term="ArcGIS 10.1" /><title>ArcGIS Server and Spatial Analyst</title><content type="html">In ArcGIS 10.0, you needed to worry about path length for raster operations if the raster path plus file name is over 154 characters. &amp;nbsp;Now at 10.1, the character length has been increased to 254. &amp;nbsp;This means for most raster operations you will not have to alter the TEMP variable for the ArcGIS account. &lt;br /&gt;
&lt;br /&gt;
If you do run into issues where spatial analyst or 3D analyst tools fail on server, but work on desktop in your model, try changing the ArcGIS account's TEMP environmental parameter to a different folder. &lt;br /&gt;
&lt;br /&gt;
A good example would be c:\serverwrksp. &amp;nbsp;You also should make sure that the ArcGIS account has read/write access to that folder.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To shorten or change the path that server uses, you need to modify the ArcGIS account's TEMP variable. &amp;nbsp;Server should then honor the new destination path. &amp;nbsp;You might have to either log in and log off or reboot the box to get the OS to honor the new variable.&lt;br /&gt;
&lt;br /&gt;
Here is how you change the variable in Windows:&lt;br /&gt;
&lt;span style="background-color: white; color: #333333; font-family: 'Segoe UI', Arial, Verdana, Tahoma, sans-serif; font-size: 13px;"&gt;To view or change environment variables:&lt;/span&gt;&lt;br /&gt;
&lt;ol style="background-color: white; margin: 16px 0px 16px 40px; padding: 0px; position: inherit;"&gt;
&lt;li style="color: #333333; font-family: 'Segoe UI', Arial, Verdana, Tahoma, sans-serif; font-size: 13px; margin: 0px; padding: 0px; position: inherit;"&gt;Right-click&amp;nbsp;&lt;b&gt;My Computer&lt;/b&gt;, and then click&amp;nbsp;&lt;b&gt;Properties&lt;/b&gt;.&lt;/li&gt;
&lt;li style="color: #333333; font-family: 'Segoe UI', Arial, Verdana, Tahoma, sans-serif; font-size: 13px; margin: 0px; padding: 0px; position: inherit;"&gt;Click the&amp;nbsp;&lt;b&gt;Advanced&lt;/b&gt;&amp;nbsp;tab.&lt;/li&gt;
&lt;li style="color: #333333; font-family: 'Segoe UI', Arial, Verdana, Tahoma, sans-serif; font-size: 13px; margin: 0px; padding: 0px; position: inherit;"&gt;Click&amp;nbsp;&lt;b&gt;Environment variables&lt;/b&gt;.&lt;/li&gt;
&lt;li style="margin: 0px; padding: 0px; position: inherit;"&gt;&lt;span style="color: #333333; font-family: Segoe UI, Arial, Verdana, Tahoma, sans-serif; font-size: x-small;"&gt;Click one the following options, for either a user or a system variable:&lt;/span&gt;&lt;ul style="color: #333333; font-family: 'Segoe UI', Arial, Verdana, Tahoma, sans-serif; font-size: 13px; margin: 16px 0px 16px 40px; padding: 0px; position: inherit;"&gt;
&lt;li style="margin: 0px; padding: 0px; position: inherit;"&gt;Click&amp;nbsp;&lt;b&gt;New&lt;/b&gt;&amp;nbsp;to add a new variable name and value.&lt;/li&gt;
&lt;li style="margin: 0px; padding: 0px; position: inherit;"&gt;Click an existing variable, and then click&amp;nbsp;&lt;b&gt;Edit&lt;/b&gt;&amp;nbsp;to change its name or value.&lt;/li&gt;
&lt;li style="margin: 0px; padding: 0px; position: inherit;"&gt;Click an existing variable, and then click&amp;nbsp;&lt;b&gt;Delete&lt;/b&gt;&amp;nbsp;to remove it.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;b&gt;Please support my idea of having a python GUI by voting it up&amp;nbsp;&lt;a href="http://ideas.arcgis.com/ideaView?id=087E00000004SmHIAU" target="_blank"&gt;here&lt;/a&gt;.&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Enjoy&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="blogger-post-footer"&gt;Copyright AJC&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/AnotherGisBlog/~4/Gk-tPrzjBbo" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://anothergisblog.blogspot.com/feeds/3656404742834938430/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=3309146341357783035&amp;postID=3656404742834938430&amp;isPopup=true" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3309146341357783035/posts/default/3656404742834938430?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3309146341357783035/posts/default/3656404742834938430?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AnotherGisBlog/~3/Gk-tPrzjBbo/arcgis-server-and-spatial-analyst.html" title="ArcGIS Server and Spatial Analyst" /><author><name>Andrew</name><uri>http://www.blogger.com/profile/16991441455885757621</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://anothergisblog.blogspot.com/2013/02/arcgis-server-and-spatial-analyst.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DU4MQnY4fCp7ImA9WhBSFU4.&quot;"><id>tag:blogger.com,1999:blog-3309146341357783035.post-7895639033917146742</id><published>2013-02-22T04:59:00.000-08:00</published><updated>2013-02-22T04:59:43.834-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-02-22T04:59:43.834-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Programming" /><category scheme="http://www.blogger.com/atom/ns#" term="ArcGIS 10" /><category scheme="http://www.blogger.com/atom/ns#" term="Python" /><category scheme="http://www.blogger.com/atom/ns#" term="ArcPy" /><category scheme="http://www.blogger.com/atom/ns#" term="ArcGIS 10.1" /><title>Creating a List with n number of entries (Python)</title><content type="html">Normally when you create a list object in python, you cannot specify the number of items in the object by default unlike say an array object in C# or C++. &amp;nbsp;I recently ran into a situation where I was using the arcpy.da cursor objects for table that could have n number of fields. &amp;nbsp;I wanted the row to be initialized with a default value, so I used the * operator on the list to multiply a single value into a multi-value list.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;pre class="bbcode_code" style="background-color: #f2f6f8; background-repeat: repeat no-repeat; border: 1px inset; color: #333333; direction: ltr; font-family: 'Courier New', Courier, monospace !important; font-size: 12px; line-height: 12px; overflow: scroll; padding: 6px;"&gt;# Get a list of fields that are not BLOB, OBJECTID, RASTER, GEOMETRY or GUID
fields = [field.name for field in arcpy.ListFields(service_table) \
                  if not(field.type.upper() in ['BLOB', 'OID', 'RASTER','GEOMETRY','GUID'])
# create a row list with default values
row = [""]* len(fields)
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
This will create a list object called row, where each value by default is an empty string ("").

&lt;br /&gt;
&lt;br /&gt;
Enjoy&lt;div class="blogger-post-footer"&gt;Copyright AJC&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/AnotherGisBlog/~4/4dikxt6JHQ0" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://anothergisblog.blogspot.com/feeds/7895639033917146742/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=3309146341357783035&amp;postID=7895639033917146742&amp;isPopup=true" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3309146341357783035/posts/default/7895639033917146742?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3309146341357783035/posts/default/7895639033917146742?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AnotherGisBlog/~3/4dikxt6JHQ0/creating-list-with-n-number-of-entries.html" title="Creating a List with n number of entries (Python)" /><author><name>Andrew</name><uri>http://www.blogger.com/profile/16991441455885757621</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://anothergisblog.blogspot.com/2013/02/creating-list-with-n-number-of-entries.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A08EQnoycCp7ImA9WhBSFEk.&quot;"><id>tag:blogger.com,1999:blog-3309146341357783035.post-66975380438770307</id><published>2013-02-21T04:30:00.000-08:00</published><updated>2013-02-21T04:30:03.498-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-02-21T04:30:03.498-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Scripting" /><category scheme="http://www.blogger.com/atom/ns#" term="Programming" /><category scheme="http://www.blogger.com/atom/ns#" term="ArcGIS Server" /><category scheme="http://www.blogger.com/atom/ns#" term="ArcGIS Online" /><category scheme="http://www.blogger.com/atom/ns#" term="Python" /><category scheme="http://www.blogger.com/atom/ns#" term="ArcGIS 10.1" /><title>Query Feature Service By Object IDs (Python)</title><content type="html">To query a feature service using object ids, you need to perform a POST. &amp;nbsp;For those who don't know the difference between a "GET" and "POST" here is a quick blurb based on the HTML specifications:&lt;br /&gt;
&lt;blockquote class="tr_bq"&gt;
"POST" means that former means that form data is to be encoded (by a browser) into a URL while the "GET" means that the form data is to appear within a message body.&amp;nbsp;&lt;/blockquote&gt;
&lt;br /&gt;
Even simpler,&amp;nbsp;"GET" is basically for just getting data where a "POST" may involve anything, like updating data, sending, or creating data.&lt;br /&gt;
&lt;br /&gt;
Using python, you can perform both "GET" and "POST" methods, but since we need a "POST" to query by IDs, here is a simple example. &amp;nbsp;Please note that most feature services limit 1000 features being returned, so if you want to grab all of the features from a feature service, you'll have to perform multiple queries to get all the features back in JSON format.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;pre class="bbcode_code" style="background-color: #f2f6f8; background-repeat: repeat no-repeat; border: 1px inset; color: #333333; direction: ltr; font-family: 'Courier New', Courier, monospace !important; font-size: 12px; line-height: 12px; overflow: scroll; padding: 6px;"&gt;import urllib2
import urllib
import urlparse
import httplib

def query_by_objectid(url, objectIDStart=0, objectIDEnd=1001):
    """ performs a POST operation where the query is called using
        the object id method.  If a feature service has more than
        1000 records, use this method to get a range of features
        from the feature service.

        Inputs:
           :url:  - string of feature service URL
           :objectIDStart: - integer of the start whole number
           :objectIDEnd: - end range whole number
        Returns:
           returns string JSON of query
    """
    url = url + '/query'
    start = int(objectIDStart)
    end = int(objectIDEnd)

    objectIDs = ",".join([str(x) for x in range(start, end)])
    headers = {"Content-type": "application/x-www-form-urlencoded",
               "Accept": "text/plain"}
    parameters = {'objectIds' : objectIDs,
                  'f' : 'json'}
    urlparams = urllib.urlencode(parameters)
    parts = urlparse.urlparse(url)
    h = httplib.HTTPConnection(parts.netloc)
    headers = {"Content-type": "application/x-www-form-urlencoded", "Accept": "text/plain"}
    h.request('POST', parts.path, urlparams, headers)
    r = h.getresponse()
    return r.read()

if __name__ == "__main__":
    url = 'http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/TaxParcel/AssessorsLiveLayers/MapServer/1'
    print query_by_objectid(url=url,
                            objectIDStart=0,
                            objectIDEnd=5)
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
So we have a simple "POST" example.  This sample should work with both ArcGIS Server 10.1 and ArcGIS Online feature services.

&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Please support my idea of having a python GUI by voting it up &lt;a href="http://ideas.arcgis.com/ideaView?id=087E00000004SmHIAU" target="_blank"&gt;here&lt;/a&gt;.&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Enjoy&lt;br /&gt;
&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;Copyright AJC&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/AnotherGisBlog/~4/uTAykUxUBQY" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://anothergisblog.blogspot.com/feeds/66975380438770307/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=3309146341357783035&amp;postID=66975380438770307&amp;isPopup=true" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3309146341357783035/posts/default/66975380438770307?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3309146341357783035/posts/default/66975380438770307?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AnotherGisBlog/~3/uTAykUxUBQY/query-feature-service-by-object-ids.html" title="Query Feature Service By Object IDs (Python)" /><author><name>Andrew</name><uri>http://www.blogger.com/profile/16991441455885757621</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>2</thr:total><feedburner:origLink>http://anothergisblog.blogspot.com/2013/02/query-feature-service-by-object-ids.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEAEQXY7eip7ImA9WhBTGEQ.&quot;"><id>tag:blogger.com,1999:blog-3309146341357783035.post-5297066807119376569</id><published>2013-02-14T17:45:00.000-08:00</published><updated>2013-02-14T17:45:00.802-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-02-14T17:45:00.802-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Programming" /><category scheme="http://www.blogger.com/atom/ns#" term="Python" /><category scheme="http://www.blogger.com/atom/ns#" term="ArcPy" /><category scheme="http://www.blogger.com/atom/ns#" term="ArcGIS 10.1" /><title>Creating an Map Document From Python (10.1)</title><content type="html">Previous posts, I have discussed ways to create map service layers from scratch, and now I'm going to show you how to create a blank map document using the '&lt;span style="font-family: monospace;"&gt;ConvertWebMapToMapDocument&lt;/span&gt;' tool in ArcToolbox. &amp;nbsp;The beauty of this tool is that it doesn't have to be run on server, but can be run from desktop. &amp;nbsp;It uses JSON based on the &lt;a href="http://resources.arcgis.com/en/help/main/10.1/index.html#//0154000004w8000000" target="_blank"&gt;ExportWebMap specification&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
A JSON map consists of the following:
&lt;br /&gt;
&lt;div&gt;
&lt;pre class="bbcode_code" style="background-color: #f2f6f8; background-repeat: repeat no-repeat; border: 1px inset; color: #333333; direction: ltr; font-family: 'Courier New', Courier, monospace !important; font-size: 12px; line-height: 12px; overflow: scroll; padding: 6px;"&gt;{ 
   "mapOptions": {}, 
   "operationalLayers": [], 
   "baseMap": [], 
   "exportOptions": {}, 
   "layoutOptions": {} 
}
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;pre class="bbcode_code" style="background-color: #f2f6f8; background-repeat: repeat no-repeat; border: 1px inset; color: #333333; direction: ltr; font-family: 'Courier New', Courier, monospace !important; font-size: 12px; line-height: 12px; overflow: scroll; padding: 6px;"&gt;import json
from arcpy import mapping
mapService = {} 
jsonDump = json.dumps(mapService) 
result = mapping.ConvertWebMapToMapDocument(jsonDump)
mxd = result.mapDocument
mxd.saveACopy(r"c:\temp\blank.mxd")
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
Now you can do whatever you need to do with your map document.&lt;div class="blogger-post-footer"&gt;Copyright AJC&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/AnotherGisBlog/~4/QRP3Ki7QDJA" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://anothergisblog.blogspot.com/feeds/5297066807119376569/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=3309146341357783035&amp;postID=5297066807119376569&amp;isPopup=true" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3309146341357783035/posts/default/5297066807119376569?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3309146341357783035/posts/default/5297066807119376569?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AnotherGisBlog/~3/QRP3Ki7QDJA/creating-map-document-from-python-101.html" title="Creating an Map Document From Python (10.1)" /><author><name>Andrew</name><uri>http://www.blogger.com/profile/16991441455885757621</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://anothergisblog.blogspot.com/2013/02/creating-map-document-from-python-101.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0MCRXw7eyp7ImA9WhBTF0g.&quot;"><id>tag:blogger.com,1999:blog-3309146341357783035.post-6226351985446553426</id><published>2013-02-13T03:37:00.003-08:00</published><updated>2013-02-13T03:37:44.203-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-02-13T03:37:44.203-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Scripting" /><category scheme="http://www.blogger.com/atom/ns#" term="Programming" /><category scheme="http://www.blogger.com/atom/ns#" term="Python" /><category scheme="http://www.blogger.com/atom/ns#" term="ArcPy" /><title>wx GUI Article for ArcGIS</title><content type="html">&lt;a href="http://betablogs.esri.com/beta/arcgis/2012/05/03/custom-wxpython-guis-an-approach-for-arcgis-10-1/" target="_blank"&gt;Here&lt;/a&gt; is an interesting article on how to create an interactive GUI for ArcGIS 10.1.&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Basically what it does is it creates the form before ArcMap/Catalog finishes loading therefore the core software doesn't prevent the mainloop() to fail. &amp;nbsp;At least that's my take on it.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
If you think custom GUIs should be part of the next major release, I suggest you go to the Esri Idea site and vote up this&lt;a href="http://ideas.arcgis.com/ideaView?id=087E00000004SmHIAU" target="_blank"&gt; idea&lt;/a&gt;. &amp;nbsp;It will need &lt;u&gt;&lt;b&gt;YOUR&lt;/b&gt;&lt;/u&gt; support to get into the next release.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Happy GUI designing!&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="blogger-post-footer"&gt;Copyright AJC&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/AnotherGisBlog/~4/HdG8eFkIS4o" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://anothergisblog.blogspot.com/feeds/6226351985446553426/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=3309146341357783035&amp;postID=6226351985446553426&amp;isPopup=true" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3309146341357783035/posts/default/6226351985446553426?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3309146341357783035/posts/default/6226351985446553426?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AnotherGisBlog/~3/HdG8eFkIS4o/wx-gui-article-for-arcgis.html" title="wx GUI Article for ArcGIS" /><author><name>Andrew</name><uri>http://www.blogger.com/profile/16991441455885757621</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>2</thr:total><feedburner:origLink>http://anothergisblog.blogspot.com/2013/02/wx-gui-article-for-arcgis.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0UCQXw8cCp7ImA9WhNaGUo.&quot;"><id>tag:blogger.com,1999:blog-3309146341357783035.post-3287021682082244168</id><published>2013-02-04T04:01:00.000-08:00</published><updated>2013-02-04T04:01:00.278-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-02-04T04:01:00.278-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="GP Task" /><category scheme="http://www.blogger.com/atom/ns#" term="Programming" /><category scheme="http://www.blogger.com/atom/ns#" term="Python" /><category scheme="http://www.blogger.com/atom/ns#" term="ArcPy" /><category scheme="http://www.blogger.com/atom/ns#" term="ArcGIS 10.1" /><title>Convert Table or Feature class to CSV (10.1)</title><content type="html">Sometimes you need to export data from a feature class or table to a CSV file. &amp;nbsp;CSV stands for comma separated values. &amp;nbsp;Wikipedia defines a CSV file as such:&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;blockquote class="tr_bq"&gt;
&lt;i&gt;A comma-separated values (CSV) file stores tabular data (numbers and text) in plain-text form. Plain text means that the file is a sequence of characters, with no data that has to be interpreted instead, as binary numbers. A CSV file consists of any number of records, separated by line breaks of some kind; each record consists of fields, separated by some other character or string, most commonly a literal comma or tab. Usually, all records have an identical sequence of fields.&lt;/i&gt;&lt;/blockquote&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
To create a CSV file at 10.1, you need to strip out certain field types: Geometry, Blob and Raster because the file format only supports plain text. &amp;nbsp;This can be done by doing the following:&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;code&gt;
&amp;nbsp;fieldnames = [f.name for f in desc.fields if f.type not in ["Geometry", "Raster", "Blob"]]&lt;/code&gt;&lt;/div&gt;
&lt;br /&gt;
Next you need to write the field names and rows to a file. &amp;nbsp;This is extremely easy with the CSV library in python. &amp;nbsp;Documentation about this standard library can be found &lt;a href="http://docs.python.org/2/library/csv.html" target="_blank"&gt;here&lt;/a&gt;. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;pre class="bbcode_code" style="background-color: #f2f6f8; background-repeat: repeat no-repeat; border: 1px inset; color: #333333; direction: ltr; font-family: 'Courier New', Courier, monospace !important; font-size: 12px; height: 204px; line-height: 12px; overflow: scroll; padding: 6px;"&gt;def get_rows(data_set, fields):
   with da.SearchCursor(data_set, fields) as cursor:
      for row in cursor:
         yield row
if __name__ == "__main__":
   data_set = arcpy.GetParameterAsText(0) # feature class/Table
   output = arcpy.GetParameterAsText(1) # csv file
   desc = arcpy.Describe(data_set)
   fieldnames = [f.name for f in desc.fields if f.type not in ["Geometry", "Raster", "Blob"]]
   rows = get_rows(data_set, fieldnames)
   with open(output,'wb') as out_file:
      out_writer = csv.writer(out_file)
      out_writer.writerow(fieldnames)
      for row in rows:
         out_writer.writerow(row)
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
Here we have a function called get_rows() which takes two parameters. &amp;nbsp;The first is the data_set, which can be a table or feature class. &amp;nbsp;The next is the fields. &amp;nbsp;At 10.1, you must define your fields unlike the 10.0 cursor objects. &amp;nbsp;The function uses the yield, which is a generator. &amp;nbsp;Basically the code only runs if the function is called in a loop (I know that's not 100% correct), but &lt;a href="http://stackoverflow.com/questions/231767/the-python-yield-keyword-explained" target="_blank"&gt;here&lt;/a&gt; is a better&amp;nbsp;explanation. &amp;nbsp;Using the CSV module in python, we can then easily write out each row within the rows generator object. &lt;br /&gt;
&lt;br /&gt;
FYI, this is written so you can put this code into a script and toolbox for ArcGIS 10.1. &amp;nbsp;Just add the imports.&lt;br /&gt;
&lt;br /&gt;
Enjoy&lt;div class="blogger-post-footer"&gt;Copyright AJC&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/AnotherGisBlog/~4/Cf9zvWUGBVQ" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://anothergisblog.blogspot.com/feeds/3287021682082244168/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=3309146341357783035&amp;postID=3287021682082244168&amp;isPopup=true" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3309146341357783035/posts/default/3287021682082244168?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3309146341357783035/posts/default/3287021682082244168?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AnotherGisBlog/~3/Cf9zvWUGBVQ/convert-table-or-feature-class-to-csv.html" title="Convert Table or Feature class to CSV (10.1)" /><author><name>Andrew</name><uri>http://www.blogger.com/profile/16991441455885757621</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://anothergisblog.blogspot.com/2013/02/convert-table-or-feature-class-to-csv.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkcERXc8eCp7ImA9WhNbFUw.&quot;"><id>tag:blogger.com,1999:blog-3309146341357783035.post-5020374992643866126</id><published>2013-01-18T05:00:00.000-08:00</published><updated>2013-01-18T05:00:04.970-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-01-18T05:00:04.970-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Programming" /><category scheme="http://www.blogger.com/atom/ns#" term="ArcPy" /><category scheme="http://www.blogger.com/atom/ns#" term="Python Add-ins" /><category scheme="http://www.blogger.com/atom/ns#" term="ArcGIS 10.1" /><title>10.1 SP 1 32 bit vs 64 bit</title><content type="html">&lt;br /&gt;
I ran across an interesting forum posting about the differences of 32 vs 64 bit python.&lt;br /&gt;
&lt;br /&gt;
Check it out here:&amp;nbsp;http://forums.arcgis.com/threads/70241-10.1-sp-1-and-32-64-bit-Python-versions&lt;br /&gt;
&lt;br /&gt;
It's worth a good read to understand if you install the 64-bit background processor provided at SP 1 how it operates and works on your machine.&lt;br /&gt;
&lt;br /&gt;
Remember if you do install the 64-bit version of python, you will have to install the 64-bit of all your extensions as well.&lt;br /&gt;
&lt;br /&gt;
Enjoy&lt;br /&gt;
&lt;div class="blogger-post-footer"&gt;Copyright AJC&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/AnotherGisBlog/~4/r-bFt5nMSMk" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://anothergisblog.blogspot.com/feeds/5020374992643866126/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=3309146341357783035&amp;postID=5020374992643866126&amp;isPopup=true" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3309146341357783035/posts/default/5020374992643866126?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3309146341357783035/posts/default/5020374992643866126?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AnotherGisBlog/~3/r-bFt5nMSMk/101-sp-1-32-bit-vs-64-bit.html" title="10.1 SP 1 32 bit vs 64 bit" /><author><name>Andrew</name><uri>http://www.blogger.com/profile/16991441455885757621</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://anothergisblog.blogspot.com/2013/01/101-sp-1-32-bit-vs-64-bit.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0QEQXo7eyp7ImA9WhNUEkw.&quot;"><id>tag:blogger.com,1999:blog-3309146341357783035.post-4146109838327140428</id><published>2013-01-03T04:15:00.000-08:00</published><updated>2013-01-03T04:15:00.403-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-01-03T04:15:00.403-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Scripting" /><category scheme="http://www.blogger.com/atom/ns#" term="Programming" /><category scheme="http://www.blogger.com/atom/ns#" term="Python" /><category scheme="http://www.blogger.com/atom/ns#" term="ArcPy" /><category scheme="http://www.blogger.com/atom/ns#" term="ArcGIS 10.1" /><title>ArcPy 10.1 - Multiple Data Frames and Data Driven Pages</title><content type="html">Data driven pages is a great way to automate map production over a given area, and it works right out of the box with a single data frame. &amp;nbsp;If you have 2 or more data frames though, you will need to control the movement of each data frame object by performing some sort of coding (ArcObjects or ArcPy).&lt;br /&gt;
&lt;br /&gt;
A simple way to move multiple data frames is to:&lt;br /&gt;
&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;Get a list of all data frames&lt;/li&gt;
&lt;li&gt;Identify the parent data frame&lt;/li&gt;
&lt;li&gt;Move the extents of the other data frame&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;
Sounds simple? &amp;nbsp;Well it is.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
To get started, get a reference to the map document&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;code&gt;
mxd = arcpy.mapping.MapDocument("CURRENT")&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Change "CURRENT" &amp;nbsp;to a path if not run in ArcMap. &amp;nbsp;Then list all the data frames&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;code&gt;
dfs = arcpy.mapping.ListDataFrames(mxd)&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Now how do you know what data frame is the parent data frame or what data frame is a&amp;nbsp;child&amp;nbsp;data frame? Luckily at 10.1, the data driven page object provides a property called dataFrame, which returns the DataFrame object. &amp;nbsp;At 10.0, you would either use names or indexing values to determine which is the parent or not, but this example is for 10.1.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;code&gt;
ddp = mxd.dataDrivePages&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;
parentDF = ddp.dataFrame&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Next step is to pan the other data frames to the extent of the parent data frame's extent.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;code&gt;
&lt;/code&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;code&gt;&lt;code&gt;
for pageNum in range(1, ddp.pageCount + 1):&lt;/code&gt;&lt;/code&gt;&lt;/div&gt;
&lt;code&gt;
&lt;/code&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;code&gt;&lt;code&gt;
&amp;nbsp; &amp;nbsp;for df in dfs:&lt;/code&gt;&lt;/code&gt;&lt;/div&gt;
&lt;code&gt;
&lt;/code&gt;
&lt;div&gt;
&lt;code&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; ddp.currentPageID = pageNum&lt;/code&gt;&lt;/div&gt;
&lt;code&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; row = ddp.pageRow&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; extent = row.Shape.extent&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; if (df.name == parentDF.name) and (df.scale == parentDF.scale):&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;print 'I found the parent frame'&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; else:&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;df.panToExtent(extent)&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp;arcpy.mapping.ExportToPNG(mxd, r"C:\Project\OutPut\ParcelAtlas_" + str(pageNum) + ".png")&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;/code&gt;
Here we have a bunch of code that loops through each data driven page area and then modifies each underlying data frame that isn't the parent. &amp;nbsp;After the data frames are changes, the code then exports the maps to PNG to the '...\output' folder with reference to the page number.
&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Enjoy&lt;/div&gt;
&lt;div class="blogger-post-footer"&gt;Copyright AJC&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/AnotherGisBlog/~4/YwKMyW2Zk0A" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://anothergisblog.blogspot.com/feeds/4146109838327140428/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=3309146341357783035&amp;postID=4146109838327140428&amp;isPopup=true" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3309146341357783035/posts/default/4146109838327140428?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3309146341357783035/posts/default/4146109838327140428?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AnotherGisBlog/~3/YwKMyW2Zk0A/arcpy-101-multiple-data-frames-and-data.html" title="ArcPy 10.1 - Multiple Data Frames and Data Driven Pages" /><author><name>Andrew</name><uri>http://www.blogger.com/profile/16991441455885757621</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://anothergisblog.blogspot.com/2013/01/arcpy-101-multiple-data-frames-and-data.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEYMQX07eip7ImA9WhNWGE4.&quot;"><id>tag:blogger.com,1999:blog-3309146341357783035.post-7970084348271099320</id><published>2012-12-18T04:03:00.000-08:00</published><updated>2012-12-18T04:03:00.302-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-12-18T04:03:00.302-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Programming" /><category scheme="http://www.blogger.com/atom/ns#" term="Python" /><category scheme="http://www.blogger.com/atom/ns#" term="ArcPy" /><category scheme="http://www.blogger.com/atom/ns#" term="Python Add-ins" /><title>Using env.addOutputsToMap </title><content type="html">The environmental variable addOutputsToMap prevents geoprocessing task results from being displayed in the TOC. &amp;nbsp;This environmental property by default is set to true, so every tool's result will display in the table of contents in ArcMap. &lt;br /&gt;
&lt;br /&gt;
When developing python add-ins, you should utilize this tool to prevent sub-processes results from being added to the map. &amp;nbsp;A good example of this, is if your python add-in creates a table if it doesn't exist for logging purposes. &amp;nbsp;Your end user does not want to see this table, or know it exists, but if addOutputsToMap is set to true, the value will display in the table of contents. &amp;nbsp;Changing it to false would prevent the data from showing.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;code&gt;
from arcpy import env&lt;br /&gt;
env.addOutputsToMap = false&lt;br /&gt;#... perform GP task...&lt;br /&gt;
env.addOutputsToMap = true&lt;/code&gt;
&lt;br /&gt;
Enjoy&lt;br /&gt;
&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;Copyright AJC&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/AnotherGisBlog/~4/viNtLL_9A_M" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://anothergisblog.blogspot.com/feeds/7970084348271099320/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=3309146341357783035&amp;postID=7970084348271099320&amp;isPopup=true" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3309146341357783035/posts/default/7970084348271099320?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3309146341357783035/posts/default/7970084348271099320?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AnotherGisBlog/~3/viNtLL_9A_M/using-envaddoutputstomap.html" title="Using env.addOutputsToMap " /><author><name>Andrew</name><uri>http://www.blogger.com/profile/16991441455885757621</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://anothergisblog.blogspot.com/2012/12/using-envaddoutputstomap.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0EFQH0zfip7ImA9WhNWF0k.&quot;"><id>tag:blogger.com,1999:blog-3309146341357783035.post-5416348434383536739</id><published>2012-12-17T04:00:00.000-08:00</published><updated>2012-12-17T04:00:11.386-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-12-17T04:00:11.386-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Scripting" /><category scheme="http://www.blogger.com/atom/ns#" term="Python" /><category scheme="http://www.blogger.com/atom/ns#" term="ArcPy" /><category scheme="http://www.blogger.com/atom/ns#" term="ArcGIS 10.1" /><title>Finding Distance Along A Line</title><content type="html">The arcpy polyline geometry object has a very helpful method called&amp;nbsp;&lt;a href="http://resources.arcgis.com/en/help/main/10.1/#/Polyline/018z00000008000000/" target="_blank"&gt;positionAlongLine&lt;/a&gt; (value, {use_percentage}). &amp;nbsp;This function finds either a distance (in the feature's coordinate system) or the percentage from the line's starting location. &amp;nbsp;It then returns a PointGeometry object that can be used for further analysis, or that can be saved out as a feature class using the CopyFeatures tool. &amp;nbsp;If you use the optional use_percentages, false means it's a distance, true means it is a percentage with values between 1-100. &amp;nbsp;If a value is great than the length or over 100 % then the last point is used. &amp;nbsp;If values are less than 0 or less than 0% then the first point is used as well.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Assuming you have a line feature class, just create a search cursor and begin accessing your locations. &amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;code&gt;
fc = r"c:\temp\lines.shp"&amp;nbsp;&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;with da.SearchCursor(fc, ["SHAPE@"] as cursor:&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;for row in cursor:&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;print row[0].positionAlongLine(10, True)

&amp;nbsp; &amp;nbsp; &lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;print row[0].positionAlongLine(10, False)&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;
Enjoy&lt;/div&gt;
&lt;div class="blogger-post-footer"&gt;Copyright AJC&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/AnotherGisBlog/~4/MvXXWeAOFjw" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://anothergisblog.blogspot.com/feeds/5416348434383536739/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=3309146341357783035&amp;postID=5416348434383536739&amp;isPopup=true" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3309146341357783035/posts/default/5416348434383536739?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3309146341357783035/posts/default/5416348434383536739?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AnotherGisBlog/~3/MvXXWeAOFjw/finding-distance-along-line.html" title="Finding Distance Along A Line" /><author><name>Andrew</name><uri>http://www.blogger.com/profile/16991441455885757621</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://anothergisblog.blogspot.com/2012/12/finding-distance-along-line.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUEFRXg6eCp7ImA9WhNWE0w.&quot;"><id>tag:blogger.com,1999:blog-3309146341357783035.post-1884456139341935224</id><published>2012-12-12T04:00:00.000-08:00</published><updated>2012-12-12T04:00:14.610-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-12-12T04:00:14.610-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Python" /><category scheme="http://www.blogger.com/atom/ns#" term="numpy" /><title>Finding and Changing Max Value in Numpy Array</title><content type="html">Today, I answered a forum question about finding and changing a numpy array. &amp;nbsp;You can use the max() and the where() in the numpy to search for values in your array and change them using loops.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
You can download a very simple example &lt;a href="https://github.com/anothergisblogsamples/arcpy_samples/blob/master/NumpyFindMaxValue.py" target="_blank"&gt;here&lt;/a&gt;.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Here is the simple code:&lt;/div&gt;
&lt;div&gt;
&lt;code&gt;
&lt;/code&gt;
&lt;br /&gt;
&lt;pre style="white-space: pre-wrap; word-wrap: break-word;"&gt;&lt;code&gt;import numpy
myarray = numpy.array([[  5.4,   7.5,   2.2,   8.5,   8.6,   7.5],
                       [  7.7,   3.5,   1.4,   9.6,   8.5,   5.5],
                       [  5.2,   6.1,   8.6,   6.7,   4.3 ,  6.8],
                       [  9.6,   4.5,   2.7,   3.6,   6.7,   4.5],
                       [  1.2,   2.3,   7.2,   6.3,   2.2,   2.0 ],
                       [  1.3,   2.0,  -99.0,    9.6,  -99.0,    1.2]
                       ]
                      )
print myarray
maxValue = myarray.max()

itemindex = numpy.where(myarray &amp;gt;= maxValue)

for i in xrange(0, len(itemindex[0])):
    array1 = itemindex[0]
    array2 = itemindex[1]
    myarray[array1[i]][array2[i]] = 0

print myarray&lt;/code&gt;&lt;/pre&gt;
&lt;pre style="white-space: pre-wrap; word-wrap: break-word;"&gt;&lt;code&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;pre style="white-space: pre-wrap; word-wrap: break-word;"&gt;&lt;/pre&gt;
&lt;code&gt;
&lt;/code&gt;&lt;/div&gt;
&lt;br /&gt;
Here we have the numpy array and find the array's maximum value. &amp;nbsp;Then using the where(), the location in the array are given back. &amp;nbsp;From there, the code then changes the values in the 2-D array from the maximum value back to zero.&lt;br /&gt;
&lt;br /&gt;
Enjoy&lt;div class="blogger-post-footer"&gt;Copyright AJC&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/AnotherGisBlog/~4/RhHwc2jz_QI" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://anothergisblog.blogspot.com/feeds/1884456139341935224/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=3309146341357783035&amp;postID=1884456139341935224&amp;isPopup=true" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3309146341357783035/posts/default/1884456139341935224?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3309146341357783035/posts/default/1884456139341935224?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AnotherGisBlog/~3/RhHwc2jz_QI/finding-and-changing-max-value-in-numpy.html" title="Finding and Changing Max Value in Numpy Array" /><author><name>Andrew</name><uri>http://www.blogger.com/profile/16991441455885757621</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>1</thr:total><feedburner:origLink>http://anothergisblog.blogspot.com/2012/12/finding-and-changing-max-value-in-numpy.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0UEQn0-cSp7ImA9WhNXF0Q.&quot;"><id>tag:blogger.com,1999:blog-3309146341357783035.post-8836900974474060295</id><published>2012-12-06T04:00:00.000-08:00</published><updated>2012-12-06T04:00:03.359-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-12-06T04:00:03.359-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Scripting" /><category scheme="http://www.blogger.com/atom/ns#" term="Programming" /><category scheme="http://www.blogger.com/atom/ns#" term="Python" /><category scheme="http://www.blogger.com/atom/ns#" term="ArcGIS 10.1" /><title>ArcPy Sample: Zipping a Shapefile </title><content type="html">I've decided to post full code samples on github. &amp;nbsp;Here is my first sample to &lt;a href="https://github.com/anothergisblogsamples/arcpy_samples/blob/master/zipshapefile.py" target="_blank"&gt;zip shapefiles&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
Enjoy&lt;div class="blogger-post-footer"&gt;Copyright AJC&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/AnotherGisBlog/~4/OuhLUnMy0AM" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://anothergisblog.blogspot.com/feeds/8836900974474060295/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=3309146341357783035&amp;postID=8836900974474060295&amp;isPopup=true" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3309146341357783035/posts/default/8836900974474060295?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3309146341357783035/posts/default/8836900974474060295?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AnotherGisBlog/~3/OuhLUnMy0AM/arcpy-sample-zipping-shapefile.html" title="ArcPy Sample: Zipping a Shapefile " /><author><name>Andrew</name><uri>http://www.blogger.com/profile/16991441455885757621</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://anothergisblog.blogspot.com/2012/12/arcpy-sample-zipping-shapefile.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DEAERnc_cCp7ImA9WhNXFk8.&quot;"><id>tag:blogger.com,1999:blog-3309146341357783035.post-180946226377627600</id><published>2012-12-04T05:11:00.000-08:00</published><updated>2012-12-04T05:11:47.948-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-12-04T05:11:47.948-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="ArcGIS 10.1" /><title>AGS 10.1 Quirk with Windows Domain Security</title><content type="html">Today I configured a test machine to use windows domain accounts at the GIS tier for security. &amp;nbsp;When I went to connect to the site using catalog, I noticed that if I included the '\' (backslash) in the user name it could not connect. &amp;nbsp;After removing the backslash, the connection worked.&lt;br /&gt;
&lt;br /&gt;
This means that if your user is 'domainname\name' you would use just the 'name' in the AGS connection string.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;Copyright AJC&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/AnotherGisBlog/~4/M9ollAGzOEs" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://anothergisblog.blogspot.com/feeds/180946226377627600/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=3309146341357783035&amp;postID=180946226377627600&amp;isPopup=true" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3309146341357783035/posts/default/180946226377627600?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3309146341357783035/posts/default/180946226377627600?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AnotherGisBlog/~3/M9ollAGzOEs/ags-101-quirk-with-windows-domain.html" title="AGS 10.1 Quirk with Windows Domain Security" /><author><name>Andrew</name><uri>http://www.blogger.com/profile/16991441455885757621</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://anothergisblog.blogspot.com/2012/12/ags-101-quirk-with-windows-domain.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DEcESXw6fCp7ImA9WhNXFU4.&quot;"><id>tag:blogger.com,1999:blog-3309146341357783035.post-6735421638551251824</id><published>2012-12-03T04:00:00.000-08:00</published><updated>2012-12-03T04:00:08.214-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-12-03T04:00:08.214-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Scripting" /><category scheme="http://www.blogger.com/atom/ns#" term="Programming" /><category scheme="http://www.blogger.com/atom/ns#" term="ArcPy" /><category scheme="http://www.blogger.com/atom/ns#" term="ArcGIS 10.1" /><title>Truncate Table, A New Way To Erase Rows</title><content type="html">Truncate table is the 10.1 way to erase ALL the rows in a table or feature class. &amp;nbsp;It will ignore any sql query, so use this tool carefully.&lt;br /&gt;
&lt;br /&gt;
Some Notes:&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Supported data types are simple, meaning no terrains, topologies, etc..&lt;/li&gt;
&lt;li&gt;Data must be unversioned to execute&lt;/li&gt;
&lt;li&gt;After rows are removed, the data is unrecoverable, so make sure you know what you are doing before you go and use this.&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
This is a good tool for workflows where you need to clear out rows on some regular basis. &lt;br /&gt;
&lt;br /&gt;
Usage Example:&lt;br /&gt;
&lt;code&gt;
import arcpy&lt;br /&gt;
from arcpy import env&lt;br /&gt;
wrksp = r"c:\temp\data.gdb"&lt;br /&gt;
env.workspace = wrksp&lt;br /&gt;
fcs = arcpy.ListFeatureClasses()&lt;br /&gt;
for fc in fcs:&lt;br /&gt;
&amp;nbsp; &amp;nbsp;arcpy.TruncateTable_management(fc)&lt;br /&gt;
del fcs&lt;/code&gt;
&lt;br /&gt;
&lt;br /&gt;
Enjoy&lt;div class="blogger-post-footer"&gt;Copyright AJC&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/AnotherGisBlog/~4/NrIxqFyoWBM" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://anothergisblog.blogspot.com/feeds/6735421638551251824/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=3309146341357783035&amp;postID=6735421638551251824&amp;isPopup=true" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3309146341357783035/posts/default/6735421638551251824?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3309146341357783035/posts/default/6735421638551251824?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AnotherGisBlog/~3/NrIxqFyoWBM/truncate-table-new-way-to-erase-rows.html" title="Truncate Table, A New Way To Erase Rows" /><author><name>Andrew</name><uri>http://www.blogger.com/profile/16991441455885757621</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://anothergisblog.blogspot.com/2012/12/truncate-table-new-way-to-erase-rows.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkMESH88eCp7ImA9WhNXEUQ.&quot;"><id>tag:blogger.com,1999:blog-3309146341357783035.post-3273701161314699185</id><published>2012-11-29T04:00:00.000-08:00</published><updated>2012-11-29T04:00:09.170-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-11-29T04:00:09.170-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Scripting" /><category scheme="http://www.blogger.com/atom/ns#" term="Programming" /><category scheme="http://www.blogger.com/atom/ns#" term="Python" /><category scheme="http://www.blogger.com/atom/ns#" term="ArcPy" /><category scheme="http://www.blogger.com/atom/ns#" term="ArcGIS 10.1" /><title>Walk, new arcpy.da function as 10.1 SP1</title><content type="html">Walk is a useful function that walks directories. &amp;nbsp;Though this is an easy function to create using recursion, it is now including as a core function at 10.1 SP1 for arcpy.&lt;br /&gt;
&lt;br /&gt;
The help describes the function as such:&lt;br /&gt;
&lt;blockquote class="tr_bq"&gt;
&lt;i&gt;Generate data names in a catalog tree by walking the tree top-down or bottom-up. Each directory/workspace in the tree yields a tuple of three: dirpath, dirnames, and filenames.&amp;nbsp;Python's os module includes an os.walk function that can be used to walk through a directory tree and find data. os.walk is file based and does not recognize database contents such as geodatabase feature classes, tables, or rasters. arcpy.da.Walk can be used to catalog data.&lt;/i&gt;&lt;/blockquote&gt;
&amp;nbsp;Example:&lt;br /&gt;
&lt;br /&gt;
&lt;code&gt;
import arcpy&lt;br /&gt;
import os&lt;br /&gt;
workspace = "c:/data"&lt;br /&gt;
feature_classes = []&lt;br /&gt;
for dirpath, dirnames, filenames in arcpy.da.Walk(workspace,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; datatype="FeatureClass",&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; type="Polygon"):&lt;br /&gt;
&amp;nbsp; &amp;nbsp; for filename in filenames:&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; feature_classes.append(os.path.join(dirpath, filename))&lt;br /&gt;
&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
Enjoy&lt;div class="blogger-post-footer"&gt;Copyright AJC&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/AnotherGisBlog/~4/UigpoirQE78" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://anothergisblog.blogspot.com/feeds/3273701161314699185/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=3309146341357783035&amp;postID=3273701161314699185&amp;isPopup=true" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3309146341357783035/posts/default/3273701161314699185?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3309146341357783035/posts/default/3273701161314699185?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AnotherGisBlog/~3/UigpoirQE78/walk-new-arcpyda-function-as-101-sp1.html" title="Walk, new arcpy.da function as 10.1 SP1" /><author><name>Andrew</name><uri>http://www.blogger.com/profile/16991441455885757621</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://anothergisblog.blogspot.com/2012/11/walk-new-arcpyda-function-as-101-sp1.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEMCRX07cCp7ImA9WhNQFU0.&quot;"><id>tag:blogger.com,1999:blog-3309146341357783035.post-170060258278809200</id><published>2012-11-21T04:53:00.000-08:00</published><updated>2012-11-21T04:54:24.308-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-11-21T04:54:24.308-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Scripting" /><category scheme="http://www.blogger.com/atom/ns#" term="Programming" /><category scheme="http://www.blogger.com/atom/ns#" term="Python" /><category scheme="http://www.blogger.com/atom/ns#" term="ArcPy" /><category scheme="http://www.blogger.com/atom/ns#" term="ArcGIS 10.1" /><title>Shift Those Polygons at 10.1</title><content type="html">The arcpy team at Esri has a great &lt;a href="http://arcpy.wordpress.com/" target="_blank"&gt;blog&lt;/a&gt; post that shows how to shift polygons using the SHAPE@XY tag. &lt;br /&gt;
Here is the sample:&lt;br /&gt;
&lt;br /&gt;
&lt;code&gt;
&lt;/code&gt;
&lt;pre&gt;&lt;code&gt;with arcpy.da.UpdateCursor(in_features, ['SHAPE@XY']) as cursor:
        for row in cursor:
            cursor.updateRow([[row[0][0] + (x_shift or 0),
                               row[0][1] + (y_shift or 0)]])
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Here we have the shape column (column 0) and to access the X and Y property, you just edit the first and second objects in the X,Y pair. &amp;nbsp;The x_shift and y_shift are float values that will move the code in one direction or another. &amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
It's very simple sample, but it shows how you can easily move polygons. &amp;nbsp;In the past you had to adjust each vertex, but now this is done&amp;nbsp;internally&amp;nbsp;thanks to the new arcpy.da module at 10.1.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="blogger-post-footer"&gt;Copyright AJC&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/AnotherGisBlog/~4/T4VppIKqDvg" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://anothergisblog.blogspot.com/feeds/170060258278809200/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=3309146341357783035&amp;postID=170060258278809200&amp;isPopup=true" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3309146341357783035/posts/default/170060258278809200?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3309146341357783035/posts/default/170060258278809200?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AnotherGisBlog/~3/T4VppIKqDvg/shift-those-polygons-at-101.html" title="Shift Those Polygons at 10.1" /><author><name>Andrew</name><uri>http://www.blogger.com/profile/16991441455885757621</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>1</thr:total><feedburner:origLink>http://anothergisblog.blogspot.com/2012/11/shift-those-polygons-at-101.html</feedburner:origLink></entry></feed>
