<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-1685715839413080921</id><updated>2011-08-10T04:02:53.352-07:00</updated><category term='C#'/><category term='Trimble'/><category term='Python'/><category term='GPS Pathfinder Office'/><category term='SQL'/><category term='plugged in not charging'/><category term='ArcGIS Explorer'/><category term='Development Faction Company Info'/><category term='ArcObjects'/><category term='GDAL dll not found'/><category term='comtypes'/><category term='ArcGIS'/><category term='cx_Oracle'/><category term='geoprocessing'/><category term='ArcSDE'/><category term='OGR'/><category term='GDAL'/><category term='battery not charging'/><category term='Oracle'/><category term='ArcSDESQLExecute'/><category term='ESRI'/><category term='Add-Ins'/><title type='text'>Development Faction</title><subtitle type='html'>Development Faction represents the cohesive minority within the geospatial community that offers affordable GIS solutions by focusing on hybrid technologies (commercial off the shelf and open source). While Development Faction is capable of delivering a wide range of innovative solutions, we concentrate on providing cost-effective solutions that have been previously unavailable in the industry.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://developmentfaction.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1685715839413080921/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://developmentfaction.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Scott M. Wiegand</name><uri>http://www.blogger.com/profile/04254954827022015613</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='25' src='http://4.bp.blogspot.com/_E5RVVgOhCb0/S_MU2SyRQ3I/AAAAAAAAAJs/lwlXRVm9Dfk/S220/globe_logo.png'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>10</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-1685715839413080921.post-7618902594731404495</id><published>2010-11-12T10:59:00.000-08:00</published><updated>2010-11-12T10:59:21.679-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='geoprocessing'/><category scheme='http://www.blogger.com/atom/ns#' term='ArcObjects'/><category scheme='http://www.blogger.com/atom/ns#' term='Python'/><category scheme='http://www.blogger.com/atom/ns#' term='ArcGIS'/><category scheme='http://www.blogger.com/atom/ns#' term='ESRI'/><title type='text'>Python Tip: Coordinate Clean Up</title><content type='html'>If you create point features from coordinates stored in flat tables you probably find cases where the longitude and latitude are reversed or a negative sign is missing.&amp;nbsp; This happens frequently if the source of the data is from a non-GIS user.&amp;nbsp; What can make fixing these mistakes more difficult is if the errors are not consistent through out the table.&amp;nbsp; The following Python example will switch the longitude and latitude if necessary and add negative signs if missing.&amp;nbsp; Note: This code is only useful if all the points are with in the same hemisphere.&amp;nbsp; If the points are located across the globe, a solution to this problem is much more difficult.&lt;br /&gt;&lt;br /&gt;First, import the modules and create the geoprocessor:&lt;br /&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;b&gt;&lt;span style="color: orange;"&gt;import&lt;/span&gt;&lt;/b&gt; sys, string, os, arcgisscripting&lt;/div&gt;&lt;div style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;gp = arcgisscripting.create()&lt;/div&gt;&lt;div style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;gp.OverWriteOutput = 1&lt;/div&gt;&lt;br /&gt;Next, create an Update Cursor:&lt;br /&gt;&lt;br /&gt;&lt;div style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;rows = gp.UpdateCursor(&lt;span style="color: #6aa84f;"&gt;r"C:\Project\sample.gdb\table"&lt;/span&gt;)&lt;br /&gt;row = rows.Next()&lt;/div&gt;&lt;br /&gt;Now you need to loop through each row in the table and get the longitude and latitude values.&amp;nbsp; Note that the XCOORDINATE and YCOORDINATE are the name of the field ins the table:&lt;br /&gt;&lt;br /&gt;&lt;div style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;b&gt;&lt;span style="color: orange;"&gt;while&lt;/span&gt;&lt;/b&gt; row:&lt;/div&gt;&lt;div style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; xCoord = row.XCOORDINATE&lt;/div&gt;&lt;div style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; yCoord = row.YCOORDINATE&lt;/div&gt;&lt;br /&gt;We will need to switch the longitude and latitude if they are reversed.&amp;nbsp; We do this by checking to see if the longitude is within a valid range.&amp;nbsp; In this all points should fall with 30 to 50 degrees West Longitude.&amp;nbsp; If they do not, we assume that they are switched and switch them:&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;b&gt;&lt;span style="color: orange;"&gt;if&lt;/span&gt;&lt;/b&gt; xCoord &amp;gt; 30 &lt;b&gt;&lt;span style="color: orange;"&gt;and&lt;/span&gt;&lt;/b&gt; xCoord &amp;lt; 50:&lt;/span&gt;&lt;br /&gt;&lt;div style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row.XCOORDINATE = yCoord&lt;/div&gt;&lt;div style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row.YCOORDINATE = xCoord&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; xCoord = yCoord&lt;/div&gt;&lt;br /&gt;We use simpler logic to check for a missing negative sign.&amp;nbsp; In this case the longitude should be negative so we check.&amp;nbsp; If it is not, we make it negative:&lt;br /&gt;&lt;br /&gt;&lt;div style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;b style="color: orange;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if&lt;/b&gt; xCoord &amp;gt; 50:&lt;/div&gt;&lt;div style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; xCoord = xCoord - (xCoord * 2)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row.XCOORDINATE = xCoord&lt;/div&gt;&lt;br /&gt;Now that the changes have been made if necessary we update the row and move to the next row:&lt;br /&gt;&lt;br /&gt;&lt;div style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rows.UpdateRow(row)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row = rows.Next()&lt;/div&gt;&lt;br /&gt;Finally, delete the cursor:&lt;br /&gt;&lt;br /&gt;&lt;div style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;b&gt;&lt;span style="color: orange;"&gt;del&lt;/span&gt;&lt;/b&gt; row&lt;br /&gt;&lt;b&gt;&lt;span style="color: orange;"&gt;del&lt;/span&gt;&lt;/b&gt; rows&lt;/div&gt;&lt;br /&gt;As you can see the values will change depending on the location of your points, but this general logic should solve most of your problems.&amp;nbsp; And like all examples, there are several ways to do most of these steps.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1685715839413080921-7618902594731404495?l=developmentfaction.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://developmentfaction.blogspot.com/feeds/7618902594731404495/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://developmentfaction.blogspot.com/2010/11/python-tip-coordinate-clean-up.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1685715839413080921/posts/default/7618902594731404495'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1685715839413080921/posts/default/7618902594731404495'/><link rel='alternate' type='text/html' href='http://developmentfaction.blogspot.com/2010/11/python-tip-coordinate-clean-up.html' title='Python Tip: Coordinate Clean Up'/><author><name>Scott M. Wiegand</name><uri>http://www.blogger.com/profile/04254954827022015613</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='25' src='http://4.bp.blogspot.com/_E5RVVgOhCb0/S_MU2SyRQ3I/AAAAAAAAAJs/lwlXRVm9Dfk/S220/globe_logo.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1685715839413080921.post-6677282840165478485</id><published>2010-09-17T05:43:00.000-07:00</published><updated>2010-09-17T05:43:29.893-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='geoprocessing'/><category scheme='http://www.blogger.com/atom/ns#' term='GPS Pathfinder Office'/><category scheme='http://www.blogger.com/atom/ns#' term='Trimble'/><category scheme='http://www.blogger.com/atom/ns#' term='Python'/><category scheme='http://www.blogger.com/atom/ns#' term='ArcGIS'/><category scheme='http://www.blogger.com/atom/ns#' term='ESRI'/><title type='text'>Migrating Data from Trimble GPS Pathfinder Office to an ESRI Geodatabase</title><content type='html'>If you use Trimble GPS Pathfinder Office, you have probably discovered that it does not export data directly into an ESRI geodatabase.&amp;nbsp; This can be a significant problem, especially if you have a large data dictionary with many features.&amp;nbsp; However, GPS Pathfinder Office does allow you to export each feature to an individual shapefile.&amp;nbsp; Using Python, we can quickly move all of the data in the shapefiles into a geodatabase.&amp;nbsp; The following script will do this automatically for you.&amp;nbsp; Some important notes, however, are:&lt;br /&gt;&lt;br /&gt;1.) This script was written quickly to get the job done.&amp;nbsp; There are many ways this can be done, and this is only one of them.&lt;br /&gt;2.) The data model of the geodatabase must match the data dictionary exactly.&amp;nbsp; This is important because the script only works if it does.&amp;nbsp; Actually, the fields do not have to have the same name, but they need to be in the same order.&amp;nbsp; You will see below why this is important.&lt;br /&gt;3.) The feature classes in the geodatabase must mach the names of the features in the data dictionary.&amp;nbsp; For example, if it is called "Roads" in the data dictionary, the feature class shoudl be called "Roads" as well.&lt;br /&gt;4.) All of the feature classes must be in the same data set.&lt;br /&gt;&lt;br /&gt;Now let's get started.&amp;nbsp; First import your modules, create a geoprocessing object, and load the Data Management Toolbox:&lt;br /&gt;&lt;br /&gt;&lt;div style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;b style="color: orange;"&gt;import&lt;/b&gt; sys, string, os, arcgisscripting&lt;/div&gt;&lt;div style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;gp = arcgisscripting.create(9.3)&lt;/div&gt;&lt;div style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;gp.AddToolbox(&lt;span style="color: #6aa84f;"&gt;"C:/Program Files/ArcGIS/ArcToolbox/Toolboxes/Data Management Tools.tbx"&lt;/span&gt;)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Next get a list of all the shapefiles in the output directory from GPS Pathfinder Office:&lt;br /&gt;&lt;br /&gt;&lt;div style="color: black;"&gt; &lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;fileList = os.listdir(&lt;span style="color: #6aa84f;"&gt;"C:\\Project\\Data_Dictionary\\SHP"&lt;/span&gt;)&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;Now we need to iterate through the list of files in the directory.&amp;nbsp; We first need to determine if the file is a shapefile by getting its extension:&lt;br /&gt;&lt;br /&gt;&lt;div style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;b style="color: orange;"&gt;for&lt;/b&gt; i &lt;b&gt;&lt;span style="color: orange;"&gt;in&lt;/span&gt;&lt;/b&gt; fileList:&lt;/div&gt;&lt;div style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; splitText = os.path.splitext(i)&lt;/div&gt;&lt;br /&gt;Now we need to check if the file extension is a shapefile, create and empty string for creating the Append parameter, and start a counter that will be used to keep track of the position of the fields:&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;b&gt;&lt;span style="color: orange;"&gt;if&lt;/span&gt;&lt;/b&gt; splitText[1] == fileExt:&lt;/span&gt;&lt;br /&gt;&lt;div style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fieldMap = &lt;span style="color: #6aa84f;"&gt;""&lt;/span&gt;&lt;/div&gt;&lt;span style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; count = -1&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Now we need to get a list of the fields in the matching feature class.&amp;nbsp; If the shapefile does not match a feature class, it will be skipped:&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;b&gt;&lt;span style="color: orange; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;try:&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;div style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fields = gp.ListFields(&lt;span style="color: #6aa84f;"&gt;"C:\\test.mdb\\Data\\"&lt;/span&gt; +\&lt;/div&gt;&lt;div style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&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; splitText[0])&lt;/div&gt;&lt;div style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;b style="color: orange;"&gt;except:&lt;/b&gt;&lt;/div&gt;&lt;div style="color: orange; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; continue&lt;/b&gt;&lt;/div&gt;&lt;br /&gt;Let's loop through the fields in the feature class and match them up to the shapefile.&amp;nbsp; We also need to increase the counter:&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;b style="color: orange;"&gt;for&lt;/b&gt; field &lt;b&gt;&lt;span style="color: orange;"&gt;in&lt;/span&gt;&lt;/b&gt; fields:&lt;/span&gt;&lt;br /&gt;&lt;div style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; count += 1&lt;/div&gt;&lt;br /&gt;It is actually not possible to make the data model exactly the same because the feature class requires an OBJECTID and Shape field.&amp;nbsp; To overcome this we will skip these fields in the field mapping:&lt;br /&gt;&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;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt; &lt;b style="color: orange;"&gt;if&lt;/b&gt; field.Name == &lt;span style="color: #6aa84f;"&gt;"Shape"&lt;/span&gt; &lt;b style="color: orange;"&gt;or&lt;/b&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; field.Name == &lt;span style="color: #6aa84f;"&gt;"OBJECTID"&lt;/span&gt;:&lt;/span&gt;&lt;br /&gt;&lt;span style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&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; &lt;b style="color: orange;"&gt;break&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;We must now get the information from the shapefile:&lt;br /&gt;&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; &lt;b style="color: orange;"&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;else:&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;div style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&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; gp.MakeFeatureLayer(&lt;span style="color: #6aa84f;"&gt;"C:\\SHP\\"&lt;/span&gt; + i,&lt;/div&gt;&lt;div style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="color: #6aa84f;"&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; "tempLayer"&lt;/span&gt;)&lt;/div&gt;&lt;div style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&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; desc = gp.Describe(&lt;span style="color: #6aa84f;"&gt;"tempLayer"&lt;/span&gt;)&lt;/div&gt;&lt;span style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; fieldInfo = desc.FieldInfo &lt;/span&gt;&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; &lt;br /&gt;In the parameter for the Append tool, we need to sepearte each field with a semicolon except for the last field:&lt;br /&gt;&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; &lt;span style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;b&gt;&lt;span style="color: orange;"&gt;if&lt;/span&gt;&lt;/b&gt; count &amp;gt; 2:&lt;/span&gt;&lt;br /&gt;&lt;span style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&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; fieldmap += &lt;span style="color: #6aa84f;"&gt;";"&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Now we build our field mapping string from all the information we just collected.&amp;nbsp; Here you will see we use the counter as the index number of the field:&lt;br /&gt;&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; &lt;span style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;fieldMap += field.Name + &lt;span style="color: #6aa84f;"&gt;" '"&lt;/span&gt; + field.Name +\&lt;/span&gt;&lt;br /&gt;&lt;span style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="color: #6aa84f;"&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; "' true true false "&lt;/span&gt; +\&lt;/span&gt;&lt;br /&gt;&lt;span style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="color: purple;"&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; str&lt;/span&gt;(field.Length) + &lt;span style="color: #6aa84f;"&gt;" "&lt;/span&gt; + field.Type +\&lt;/span&gt;&lt;br /&gt;&lt;span style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="color: #6aa84f;"&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; " 0 0 ,First,#,C:\\SHP\\"&lt;/span&gt; + i + &lt;span style="color: #6aa84f;"&gt;","&lt;/span&gt; +\&lt;/span&gt;&lt;br /&gt;&lt;span style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&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; fieldInfo.GetFieldName(count) + &lt;span style="color: #6aa84f;"&gt;",-1,-1"&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;We can now finish the script by using the Append tool to append the records from the shapefile to the feature class:&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;gp.Append_management(&lt;span style="color: #6aa84f;"&gt;"C:\\SHP\\"&lt;/span&gt; + i,&lt;/span&gt;&lt;br /&gt;&lt;span style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="color: #6aa84f;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "C:\\test.mdb\\Data\\"&lt;/span&gt; + splitText[0], &lt;span style="color: #6aa84f;"&gt;"NO_TEST"&lt;/span&gt;,&lt;/span&gt;&lt;br /&gt;&lt;span style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fieldMap, &lt;span style="color: #6aa84f;"&gt;""&lt;/span&gt;)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;As you can tell, this not necessarily the most efficient way to do this.&amp;nbsp; I have since rewritten this process using C# to create a more stable tool, however, this fairly simple script can save you quite a bit of time.&amp;nbsp; I encourage you to modify it and make it work even better.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1685715839413080921-6677282840165478485?l=developmentfaction.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://developmentfaction.blogspot.com/feeds/6677282840165478485/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://developmentfaction.blogspot.com/2010/09/migrating-data-from-trimble-gps.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1685715839413080921/posts/default/6677282840165478485'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1685715839413080921/posts/default/6677282840165478485'/><link rel='alternate' type='text/html' href='http://developmentfaction.blogspot.com/2010/09/migrating-data-from-trimble-gps.html' title='Migrating Data from Trimble GPS Pathfinder Office to an ESRI Geodatabase'/><author><name>Scott M. Wiegand</name><uri>http://www.blogger.com/profile/04254954827022015613</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='25' src='http://4.bp.blogspot.com/_E5RVVgOhCb0/S_MU2SyRQ3I/AAAAAAAAAJs/lwlXRVm9Dfk/S220/globe_logo.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1685715839413080921.post-5419855019611699842</id><published>2010-08-20T08:20:00.000-07:00</published><updated>2010-11-19T15:08:25.124-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='geoprocessing'/><category scheme='http://www.blogger.com/atom/ns#' term='Python'/><category scheme='http://www.blogger.com/atom/ns#' term='ArcGIS'/><category scheme='http://www.blogger.com/atom/ns#' term='ESRI'/><title type='text'>Python Tip: Iterating through a feature class</title><content type='html'>After you have mastered creating Python scripts to perform geoprocessing tasks on single feature classes, you will probably realize that you will often come across cases where you will want to perform the same tasks on all the features in a feature class, such as adding a field, adding a prefix or suffix to the name, etc.&amp;nbsp; Accomplishing this is very easy.&amp;nbsp; You ill need to iterate through a feature class using the &lt;i&gt;ListFeatureClasses&lt;/i&gt; function.&amp;nbsp; I will give you an example that capitalizes the names of the feature classes in a feature class.&amp;nbsp; Start by importing the proper modules:&lt;br /&gt;&lt;br /&gt;&lt;div style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;b style="color: orange;"&gt;import&lt;/b&gt; sys, string, os, os.path, arcgisscripting&lt;/div&gt;&lt;br /&gt;Next add the toolbox with the Rename tool:&lt;br /&gt;&lt;br /&gt;&lt;span style="color: black; font-family: 'Courier New', Courier, monospace;"&gt;gp.AddToolbox(&lt;span style="color: #6aa84f;"&gt;"C:/Program Files/ArcGIS/ArcToolbox/Toolboxes/Data Management Tools.tbx"&lt;/span&gt;)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Set the workspace to the feature class you wish to edit:&lt;br /&gt;&lt;br /&gt;&lt;div style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;gp.workspace = &lt;span style="color: #6aa84f;"&gt;"Database Connections\\GIS.sde\\Data"&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;Call the &lt;i&gt;ListFeatureClasses&lt;/i&gt; function and move to the first feature class:&lt;br /&gt;&lt;br /&gt;&lt;div style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;fcList = gp.ListFeatureClasses (&lt;span style="color: #6aa84f;"&gt;"*"&lt;/span&gt;, &lt;span style="color: #6aa84f;"&gt;"all"&lt;/span&gt;)&lt;br /&gt;fc = fcList.Next()&lt;/div&gt;&lt;br /&gt;Now loop through and rename each feature class:&lt;br /&gt;&lt;br /&gt;&lt;div style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;b style="color: orange;"&gt;while&lt;/b&gt; fc &amp;lt;&amp;gt; &lt;span class="Apple-style-span" style="color: purple;"&gt;None&lt;/span&gt;:&lt;/div&gt;&lt;div style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.Rename_management(gp.workspace +&lt;span style="color: black;"&gt; &lt;span style="color: #6aa84f;"&gt;"\\"&lt;/span&gt; + fc,&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&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; gp.workspace + &lt;span style="color: #6aa84f;"&gt;"\\"&lt;/span&gt; + fc.upper() \&lt;/div&gt;&lt;div style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&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; + &lt;span style="color: #6aa84f;"&gt;"_temp"&lt;/span&gt;, &lt;span style="color: #6aa84f;"&gt;"FeatureClass"&lt;/span&gt;)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.Rename_management(gp.workspace + &lt;span style="color: #6aa84f;"&gt;"\\"&lt;/span&gt; + fc.upper() \&lt;/div&gt;&lt;div style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&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; + &lt;span style="color: #6aa84f;"&gt;"_temp"&lt;/span&gt;, &amp;nbsp;&lt;/div&gt;&lt;div style="color: black;"&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&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; gp.workspace + &lt;span style="color: #6aa84f;"&gt;"\\"&lt;/span&gt; + fc.upper(),&lt;/span&gt;&lt;/div&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&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; &lt;span style="color: #6aa84f;"&gt;"FeatureClass"&lt;/span&gt;)&lt;/span&gt;&lt;span style="color: black; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: black; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fc = fcList.Next()&lt;/span&gt; &lt;br /&gt;&lt;br /&gt;Because ArcGIS is not case-sensitive, we had to temporarily rename the feature classes with "_temp" at the end, and then rename them again and capitalize them.&amp;nbsp; Also, remember to call the &lt;i&gt;Next&lt;/i&gt; function to move to the next record or you will be stuck in an infinite loop.&lt;br /&gt;&lt;br /&gt;In this case, we ran through every feature class but using the wild card parameter, you can select a subset of the feature classes.&amp;nbsp; Other similar functions exist that are also useful such as &lt;i&gt;ListDatasets&lt;/i&gt; and &lt;i&gt;ListTables&lt;/i&gt;.&amp;nbsp; I recommend that you read more about these functions &lt;a href="http://webhelp.esri.com/arcgisdesktop/9.3/index.cfm?id=1029&amp;amp;pid=980&amp;amp;topicname=ListFeatureClasses_method"&gt;here&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1685715839413080921-5419855019611699842?l=developmentfaction.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://developmentfaction.blogspot.com/feeds/5419855019611699842/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://developmentfaction.blogspot.com/2010/08/python-tip-iterating-through-feature.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1685715839413080921/posts/default/5419855019611699842'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1685715839413080921/posts/default/5419855019611699842'/><link rel='alternate' type='text/html' href='http://developmentfaction.blogspot.com/2010/08/python-tip-iterating-through-feature.html' title='Python Tip: Iterating through a feature class'/><author><name>Scott M. Wiegand</name><uri>http://www.blogger.com/profile/04254954827022015613</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='25' src='http://4.bp.blogspot.com/_E5RVVgOhCb0/S_MU2SyRQ3I/AAAAAAAAAJs/lwlXRVm9Dfk/S220/globe_logo.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1685715839413080921.post-3606717872431344430</id><published>2010-08-06T05:20:00.000-07:00</published><updated>2010-08-16T09:25:04.011-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='geoprocessing'/><category scheme='http://www.blogger.com/atom/ns#' term='Python'/><category scheme='http://www.blogger.com/atom/ns#' term='ArcGIS'/><category scheme='http://www.blogger.com/atom/ns#' term='ESRI'/><title type='text'>3 Quick Python Tips to Make Geoprocessing Easier</title><content type='html'>&lt;style&gt;&lt;!-- /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:""; margin:0in; margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman";}p {mso-margin-top-alt:auto; margin-right:0in; mso-margin-bottom-alt:auto; margin-left:0in; mso-pagination:widow-orphan; font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman";}@page Section1 {size:8.5in 11.0in; margin:1.0in 1.25in 1.0in 1.25in; mso-header-margin:.5in; mso-footer-margin:.5in; mso-paper-source:0;}div.Section1 {page:Section1;}--&gt;&lt;/style&gt;  &lt;br /&gt;&lt;b&gt;&lt;span style="font-family: Arial;"&gt;1. Ignoring escape characters&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;b&gt;&lt;span style="font-family: Arial;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;style&gt;&lt;!-- /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:""; margin:0in; margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman";}p {mso-margin-top-alt:auto; margin-right:0in; mso-margin-bottom-alt:auto; margin-left:0in; mso-pagination:widow-orphan; font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman";}@page Section1 {size:8.5in 11.0in; margin:1.0in 1.25in 1.0in 1.25in; mso-header-margin:.5in; mso-footer-margin:.5in; mso-paper-source:0;}div.Section1 {page:Section1;}--&gt;&lt;/style&gt;  &lt;br /&gt;&lt;span style="font-family: Arial;"&gt;When you export a Python script from Model Builder, you have probably noticed that the “\” in the directory paths are modified in two ways, either “/” or “\\”.&amp;nbsp; This is because “\” is an escape character.&amp;nbsp; Basically, “\” tells Python to look at the following character and do something special.&amp;nbsp; For example “\n” tells Python to start a new line.&amp;nbsp; However, if you are like me, you usually copy and paste a file path and it is a hassle to have to change every occurrence of “\”.&amp;nbsp; Luckily there is away to tell Python to ignore the “\” in a string as an escape character.&amp;nbsp; You can do this by placing an “r” directly in front of the string.&amp;nbsp; So here are three ways to create the same string:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: Arial;"&gt;&amp;nbsp;&lt;/span&gt;&lt;style&gt;&lt;!-- /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:""; margin:0in; margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman";}p {mso-margin-top-alt:auto; margin-right:0in; mso-margin-bottom-alt:auto; margin-left:0in; mso-pagination:widow-orphan; font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman";}@page Section1 {size:8.5in 11.0in; margin:1.0in 1.25in 1.0in 1.25in; mso-header-margin:.5in; mso-footer-margin:.5in; mso-paper-source:0;}div.Section1 {page:Section1;}--&gt;&lt;/style&gt;  &lt;br /&gt;&lt;span style="color: #38761d; font-family: &amp;quot;Courier New&amp;quot;;"&gt;r"C:\Program Files\ArcGIS\ArcToolbox\Toolboxes"&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #38761d; font-family: &amp;quot;Courier New&amp;quot;;"&gt;"C:/Program Files/ArcGIS/ArcToolbox/Toolboxes"&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #38761d; font-family: &amp;quot;Courier New&amp;quot;;"&gt;"C:\\Program Files\\ArcGIS\\ArcToolbox\\Toolboxes"&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;style&gt;&lt;!-- /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:""; margin:0in; margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman";}p {mso-margin-top-alt:auto; margin-right:0in; mso-margin-bottom-alt:auto; margin-left:0in; mso-pagination:widow-orphan; font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman";}@page Section1 {size:8.5in 11.0in; margin:1.0in 1.25in 1.0in 1.25in; mso-header-margin:.5in; mso-footer-margin:.5in; mso-paper-source:0;}div.Section1 {page:Section1;}--&gt;&lt;/style&gt;  &lt;br /&gt;&lt;b&gt;&lt;span style="font-family: Arial;"&gt;2. Getting the directory location of the current script&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;style&gt;&lt;!-- /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:""; margin:0in; margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman";}p {mso-margin-top-alt:auto; margin-right:0in; mso-margin-bottom-alt:auto; margin-left:0in; mso-pagination:widow-orphan; font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman";}@page Section1 {size:8.5in 11.0in; margin:1.0in 1.25in 1.0in 1.25in; mso-header-margin:.5in; mso-footer-margin:.5in; mso-paper-source:0;}div.Section1 {page:Section1;}--&gt;&lt;/style&gt;  &lt;br /&gt;&lt;span style="font-family: Arial;"&gt;When creating batch scripts that you will reuse frequently for files in various locations, it can be time consuming to modify the file directory before running the script every time.&amp;nbsp; One method of making this step easier is by placing the script in the same directory as the files you want to process.&amp;nbsp; To do this, you can have the script use the directory it is located in using the &lt;i&gt;getcwd&lt;/i&gt; function.&amp;nbsp; This function returns the directory that the script is located in.&amp;nbsp; First import the os module and then call the &lt;i&gt;getcwd&lt;/i&gt; function:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;span style="color: orange; font-family: &amp;quot;Courier New&amp;quot;;"&gt;import&lt;/span&gt;&lt;/b&gt;&lt;span style="color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt; os&lt;/span&gt;&lt;br /&gt;&lt;span style="color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt;directory = os.getcwd()&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;style&gt;&lt;!-- /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:""; margin:0in; margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman";}p {mso-margin-top-alt:auto; margin-right:0in; mso-margin-bottom-alt:auto; margin-left:0in; mso-pagination:widow-orphan; font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman";}@page Section1 {size:8.5in 11.0in; margin:1.0in 1.25in 1.0in 1.25in; mso-header-margin:.5in; mso-footer-margin:.5in; mso-paper-source:0;}div.Section1 {page:Section1;}--&gt;&lt;/style&gt;  &lt;br /&gt;&lt;b&gt;&lt;span style="font-family: Arial;"&gt;3. Create a data stamp&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;style&gt;&lt;!-- /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:""; margin:0in; margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman";}p {mso-margin-top-alt:auto; margin-right:0in; mso-margin-bottom-alt:auto; margin-left:0in; mso-pagination:widow-orphan; font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman";}@page Section1 {size:8.5in 11.0in; margin:1.0in 1.25in 1.0in 1.25in; mso-header-margin:.5in; mso-footer-margin:.5in; mso-paper-source:0;}div.Section1 {page:Section1;}--&gt;&lt;/style&gt;  &lt;br /&gt;&lt;span style="font-family: Arial;"&gt;When processing file, you may want to create a date stamp on the end of the file name or write the date to a txt file.&amp;nbsp; Creating a date stamp is fairly easy First import the time module, then call the &lt;i&gt;localtime&lt;/i&gt; function to return the current date and time on the system.&amp;nbsp; This example returns a string in the “MM_DD_YYYY format:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;span style="color: orange; font-family: &amp;quot;Courier New&amp;quot;;"&gt;import&lt;/span&gt;&lt;/b&gt;&lt;span style="color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt; time&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;u1:p&gt;&lt;/u1:p&gt;  &lt;br /&gt;&lt;span style="color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt;t = time.localtime()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;u1:p&gt;&lt;/u1:p&gt;  &lt;br /&gt;&lt;span style="color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt;date = &lt;/span&gt;&lt;span style="color: purple; font-family: &amp;quot;Courier New&amp;quot;;"&gt;str&lt;/span&gt;&lt;span style="color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt;(t[1]) + &lt;/span&gt;&lt;span style="color: #38761d; font-family: &amp;quot;Courier New&amp;quot;;"&gt;"_"&lt;/span&gt;&lt;span style="color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt; + &lt;/span&gt;&lt;span style="color: purple; font-family: &amp;quot;Courier New&amp;quot;;"&gt;str&lt;/span&gt;&lt;span style="color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt;(t[2]) + &lt;/span&gt;&lt;span style="color: #38761d; font-family: &amp;quot;Courier New&amp;quot;;"&gt;"_"&lt;/span&gt;&lt;span style="color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt; + &lt;/span&gt;&lt;span style="color: purple; font-family: &amp;quot;Courier New&amp;quot;;"&gt;str&lt;/span&gt;&lt;span style="color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt;(t[0])&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: Arial;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: Arial;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: Arial;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: Arial;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1685715839413080921-3606717872431344430?l=developmentfaction.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://developmentfaction.blogspot.com/feeds/3606717872431344430/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://developmentfaction.blogspot.com/2010/08/3-quick-python-tips-to-make.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1685715839413080921/posts/default/3606717872431344430'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1685715839413080921/posts/default/3606717872431344430'/><link rel='alternate' type='text/html' href='http://developmentfaction.blogspot.com/2010/08/3-quick-python-tips-to-make.html' title='3 Quick Python Tips to Make Geoprocessing Easier'/><author><name>Scott M. Wiegand</name><uri>http://www.blogger.com/profile/04254954827022015613</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='25' src='http://4.bp.blogspot.com/_E5RVVgOhCb0/S_MU2SyRQ3I/AAAAAAAAAJs/lwlXRVm9Dfk/S220/globe_logo.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1685715839413080921.post-3165609625866309934</id><published>2010-07-23T20:36:00.000-07:00</published><updated>2010-07-23T20:57:15.914-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='plugged in not charging'/><category scheme='http://www.blogger.com/atom/ns#' term='battery not charging'/><title type='text'>Plugged In, Not Charging</title><content type='html'>Ahh, the dreaded "Plugged In, Not Charging" message.  What a wonderful feeling.  I have personally dealt with this issue quite often, and have discovered several possible resolutions.  The one that works the best will likely surprise many, if not only because you cannot believe you did not try it already.&lt;br /&gt;&lt;br /&gt;In my attempts to resolve this issue, I have come across many solutions.  At least one post suggests an elaborate process involving battery removal, shutdown, restarting, and battery replacement (or something to that effect).  You can view that information &lt;a href="http://forums.cnet.com/5208-19681_102-0.html?threadID=345945"&gt;here&lt;/a&gt;.  I have not had success with this one, but have come across several posters who claim success.  For whoever initiated this methodology, I applaud you.  At least one other post suggests uninstalling the device driver and forcing the the system to rediscover the device.  I have had success with this procedure on at least one occasion.  You can view that topic of discussion &lt;a href="http://forums.cnet.com/5208-19681_102-0.html?threadID=345945"&gt;here&lt;/a&gt;.  Still others (source of which I do not recall) suggest potential hardware issues, such as a bad power adapter.&lt;br /&gt;&lt;br /&gt;So what is my "magic" solution for this issue?  Clean the thing.  It's probably dirty.  Go out and get yourself a few pipe cleaners and some alcohol.  Unplug your power adapter (safety first!), and take the battery out of your laptop.  Get a touch of alcohol on the pipe cleaners and carefully clean out the power port on your laptop.  You may also want to clean the exterior and interior of the end of the power adapter itself.  Be very careful with this one, because if you break the pin in the adapter it is basically a paperweight.  Again, make sure you unplug it first.&lt;br /&gt;&lt;br /&gt;If you are not sure if this is your issue or not, one way to find out is to see if your system charges when it is shut down.  If not, check your bios and look at the batter info.  If your system indicates an unrecognized device in the bios, then it is likely that there is something wrong with your connection or the adapter itself.  Dirty connections is one of the easiest things your can troubleshoot, and it may very well save you the time and money of going out and buying a new battery or power adapter.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1685715839413080921-3165609625866309934?l=developmentfaction.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://developmentfaction.blogspot.com/feeds/3165609625866309934/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://developmentfaction.blogspot.com/2010/07/plugged-in-not-charging.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1685715839413080921/posts/default/3165609625866309934'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1685715839413080921/posts/default/3165609625866309934'/><link rel='alternate' type='text/html' href='http://developmentfaction.blogspot.com/2010/07/plugged-in-not-charging.html' title='Plugged In, Not Charging'/><author><name>Anthony Grescavage</name><uri>http://www.blogger.com/profile/00254974879867259338</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://1.bp.blogspot.com/_9-f91PE3F6M/TCAlEFAa6YI/AAAAAAAAAAU/xt_94N0h7Ls/S220/20050712_0426PM_3.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1685715839413080921.post-439451125212879587</id><published>2010-07-12T10:58:00.000-07:00</published><updated>2010-07-14T06:29:05.777-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ArcSDESQLExecute'/><category scheme='http://www.blogger.com/atom/ns#' term='geoprocessing'/><category scheme='http://www.blogger.com/atom/ns#' term='ArcObjects'/><category scheme='http://www.blogger.com/atom/ns#' term='Python'/><category scheme='http://www.blogger.com/atom/ns#' term='ESRI'/><title type='text'>Python Tip: Using ArcSDESQLExecute to access ArcSDE data faster</title><content type='html'>&lt;o:smarttagtype name="State" namespaceuri="urn:schemas-microsoft-com:office:smarttags"&gt;&lt;/o:smarttagtype&gt;&lt;o:smarttagtype name="place" namespaceuri="urn:schemas-microsoft-com:office:smarttags"&gt;&lt;/o:smarttagtype&gt;&lt;style&gt;&lt;!-- /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:""; margin:0in; margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman";}@page Section1 {size:8.5in 11.0in; margin:1.0in 1.25in 1.0in 1.25in; mso-header-margin:.5in; mso-footer-margin:.5in; mso-paper-source:0;}div.Section1 {page:Section1;}--&gt;&lt;/style&gt;  &lt;br /&gt;&lt;div class="MsoNormal"&gt;In a previous post titled &lt;a href="http://developmentfaction.blogspot.com/2010/05/using-python-to-access-arcsde-data.html"&gt;“Using Python to access ArcSDE data faster with cx_Oracle”&lt;/a&gt; I described a Python module that allowed faster access to ArcSDE data stored in an Oracle database.&amp;nbsp; Another method exists that will allow you to access ArcSDE data with pure SQL queries using the ArcScripting geoprocessing libraries.&amp;nbsp; We can accomplish this by creating the &lt;a href="http://webhelp.esri.com/arcgisdesktop/9.3/index.cfm?id=988&amp;amp;pid=980&amp;amp;topicname=ArcSDESQLExecute_properties" target="_blank"&gt;ArcSDESQLExecute&lt;/a&gt; object.&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;To help demonstrate the capabilities of this function, we will create an example that queries the ArcSDE database and then uses some Python functionality to generate a CSV file from the results.&amp;nbsp; Start by importimg the necessary libraries and creating a geoprocessor object:&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&lt;b&gt;&lt;span style="color: orange;"&gt;import&lt;/span&gt;&lt;/b&gt; arcgisscripting, os&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;gp = arcgisscripting.create(9.3)&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;Next create the ArcSDESQLExecute object.&amp;nbsp; The second parameter is the path to the SDE connection file:&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;sdeConn = gp.CreateObject(&lt;span style="color: #6aa84f;"&gt;"ARCSDESQLEXECUTE"&lt;/span&gt;, &lt;span style="color: #6aa84f;"&gt;"Database Connections\\GIS.sde"&lt;/span&gt;)&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;Now let’s create an SQL statement and execute it.&amp;nbsp; Note:&amp;nbsp; This function will execute any valid SQL statement that you have permission to perform, including Updates and Deletes.&amp;nbsp; This is an excellent way of performing fast attribution changes.&amp;nbsp; However, use caution when modifying data:&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;sql = &lt;span style="color: #6aa84f;"&gt;"SELECT OBJECTID, ROADNAME FROM ROADSEGMENT"&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;sdeReturn = sdeConn.Execute(sql)&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;The next section of code will generate a CSV file so that the output can easily be opened in Excel or Access.&amp;nbsp; You can modify it to any type of TXT file you wish.&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="color: purple;"&gt;file&lt;/span&gt; = &lt;span style="color: purple;"&gt;open&lt;/span&gt;(&lt;span style="color: #6aa84f;"&gt;"output.csv"&lt;/span&gt;, &lt;span style="color: #6aa84f;"&gt;'w'&lt;/span&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&lt;b&gt;&lt;span style="color: orange;"&gt;for&lt;/span&gt;&lt;/b&gt; row &lt;b style="color: orange;"&gt;in&lt;/b&gt; sdeReturn:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; line = &lt;span style="color: #6aa84f;"&gt;""&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;b&gt;&lt;span style="color: orange;"&gt;for&lt;/span&gt;&lt;/b&gt; i &lt;b style="color: orange;"&gt;in&lt;/b&gt; row:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; line += &lt;span style="color: purple;"&gt;str&lt;/span&gt;(i) + &lt;span style="color: #6aa84f;"&gt;","&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: purple;"&gt;file&lt;/span&gt;.write(line + &lt;span style="color: #6aa84f;"&gt;"\n"&lt;/span&gt;)&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;Finally, close the file and delete the ArcSDESQLExecute object:&lt;br /&gt;&lt;br /&gt;&lt;div style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="color: purple;"&gt;file&lt;/span&gt;.close()&lt;/span&gt;&lt;/div&gt;&lt;span style="color: black; font-size: small;"&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;b style="color: orange;"&gt;del&lt;/b&gt; sdeReturn &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;You will see that this function performs SQL queries much faster than the other geoprocessing tools because it uses the RDBMS to execute them.&amp;nbsp; ArcSDESQLExecute can even rollback transactions.&amp;nbsp; For more information see the ESRI &lt;a href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//000v00000057000000.htm" target="_blank"&gt;documentation&lt;/a&gt;.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1685715839413080921-439451125212879587?l=developmentfaction.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://developmentfaction.blogspot.com/feeds/439451125212879587/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://developmentfaction.blogspot.com/2010/07/python-tip-using-arcsdesqlexecute-to.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1685715839413080921/posts/default/439451125212879587'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1685715839413080921/posts/default/439451125212879587'/><link rel='alternate' type='text/html' href='http://developmentfaction.blogspot.com/2010/07/python-tip-using-arcsdesqlexecute-to.html' title='Python Tip: Using ArcSDESQLExecute to access ArcSDE data faster'/><author><name>Scott M. Wiegand</name><uri>http://www.blogger.com/profile/04254954827022015613</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='25' src='http://4.bp.blogspot.com/_E5RVVgOhCb0/S_MU2SyRQ3I/AAAAAAAAAJs/lwlXRVm9Dfk/S220/globe_logo.png'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1685715839413080921.post-2992189914043286508</id><published>2010-06-22T20:07:00.000-07:00</published><updated>2010-07-14T06:36:56.408-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='GDAL'/><category scheme='http://www.blogger.com/atom/ns#' term='ArcGIS Explorer'/><category scheme='http://www.blogger.com/atom/ns#' term='OGR'/><category scheme='http://www.blogger.com/atom/ns#' term='GDAL dll not found'/><category scheme='http://www.blogger.com/atom/ns#' term='Add-Ins'/><category scheme='http://www.blogger.com/atom/ns#' term='ESRI'/><title type='text'>Using GDAL with ArcGIS Explorer</title><content type='html'>&lt;a href="http://www.esri.com/software/arcgis/explorer/index.html" target="_blank"&gt;ArcGIS Explorer&lt;/a&gt; has extremely limited functionality right out of the box.  If you are looking to do anything other than simply viewing data, you may find it very difficult with the ArcGIS Explorer api and standard .NET libraries.  Fortunately, there are many open source GIS libraries that can be used to fill the gaps where the api is lacking.  One such library is &lt;a href="http://www.gdal.org/" target="_blank"&gt;GDAL / OGR&lt;/a&gt;.  These libraries can be found in the &lt;a href="http://fwtools.maptools.org/" target="_blank"&gt;FWTools&lt;/a&gt; software package and are used in various commercial applications.&lt;br /&gt;&lt;br /&gt;Much of the ArcGIS Explorer functionality is provided by these exact libraries.  Therein lies our problem.  The fact that the libraries are used in the application is not a problem in itself.  The problem typically surfaces when you download the latest version of the library and attempt to use with Explorer.  You may run into all sorts of odd problems, with the most common being a "dll not found" error.  This error can be very misleading.  The first reaction might be to see if the dll actually exists.  If you check, you will find that it DOES exist, and it is in a location where the application should be able to find it.  So why does Explorer give a dll not found error?  Welcome to &lt;a href="http://en.wikipedia.org/wiki/DLL_hell" target="_blank"&gt;dll hell&lt;/a&gt;.  For many a COM developer, this is familiar territory, but not so for .NET developers.  In .NET, dll hell has been all but eradicated.&lt;br /&gt;&lt;br /&gt;For those unfamiliar with dll hell, the short explination goes something like this: windows has a specific order in which it looks for dll's.  It typically starts with the directory containing the application, after which it will search through each of the directories in the path variable.  During this sequence, it will load the very first dll it finds with a matching name.  "So what happens when the dll it finds is not the one my application is expecting?" you ask.  This, my friends, is dll hell.  I cannot tell you specifically what will happen in your case, but chances are it will not be good.&lt;br /&gt;&lt;br /&gt;So why are we experiencing it here?  Well, GDAL is not a native .NET library.  It is written in C/C++ with .NET wrappers built on top.  To some degree, the "dll not found" error is accurate, because it did not find the version of the dll it was searching for.  So how do we fix that?  Well, the simple answer is to simply use the same version of GDAL that is used by the main application.  What is good about this is that you will not even need to include the dlls with your deployment, since they already exist within the application.  You will have to include any of the .NET wrappers you use, however.&lt;br /&gt;&lt;br /&gt;One roadblock that you may run into is finding the right version of GDAL.  In the case of ArcGIS Explorer 10, GDAL 1.6.1 is used.  Tracking down the right files can prove troublesome, since the version you need may not exist in binary form, which means you may have to download the source and compile it yourself.  Since GDAL is typically built using nMake files, this can be quite a chore for the inexperienced.  Fortunately, I have already done this for you, and I'm providing the .NET dlls for your convenience &lt;a href="http://devfaction.com/Download.aspx?file=downloads%5CGDAL_DotNet.zip"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;If the version of GDAL that is included with the version of the application you have is different than the one posted here, you can find the instructions on how to build from source &lt;a href="http://trac.osgeo.org/gdal/wiki/BuildHints" target="_blank"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Using GDAL with ArcGIS Explorer, you can potentially add on a mountain of functionality that does not exist natively within the application.  For those who need some additional functionality but cannot afford to pony up the dough for a full blown ArcGIS license, this may be the solution you are looking for.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1685715839413080921-2992189914043286508?l=developmentfaction.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://developmentfaction.blogspot.com/feeds/2992189914043286508/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://developmentfaction.blogspot.com/2010/06/using-gdal-with-arcgis-explorer.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1685715839413080921/posts/default/2992189914043286508'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1685715839413080921/posts/default/2992189914043286508'/><link rel='alternate' type='text/html' href='http://developmentfaction.blogspot.com/2010/06/using-gdal-with-arcgis-explorer.html' title='Using GDAL with ArcGIS Explorer'/><author><name>Anthony Grescavage</name><uri>http://www.blogger.com/profile/00254974879867259338</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://1.bp.blogspot.com/_9-f91PE3F6M/TCAlEFAa6YI/AAAAAAAAAAU/xt_94N0h7Ls/S220/20050712_0426PM_3.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1685715839413080921.post-7596184322557169817</id><published>2010-05-28T07:06:00.000-07:00</published><updated>2010-07-14T06:38:19.616-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='geoprocessing'/><category scheme='http://www.blogger.com/atom/ns#' term='ArcSDE'/><category scheme='http://www.blogger.com/atom/ns#' term='comtypes'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='ArcObjects'/><category scheme='http://www.blogger.com/atom/ns#' term='Python'/><category scheme='http://www.blogger.com/atom/ns#' term='ESRI'/><title type='text'>Using ArcObjects for coordinate transformations in Python</title><content type='html'>&lt;style&gt;&lt;!-- /* Font Definitions */ @font-face {font-family:Helvetica; panose-1:2 11 6 4 2 2 2 2 2 4; mso-font-charset:0; mso-generic-font-family:swiss; mso-font-format:other; mso-font-pitch:variable; mso-font-signature:3 0 0 0 1 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:""; margin:0in; margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman";}@page Section1 {size:8.5in 11.0in; margin:1.0in 1.25in 1.0in 1.25in; mso-header-margin:.5in; mso-footer-margin:.5in; mso-paper-source:0;}div.Section1 {page:Section1;}--&gt;&lt;/style&gt;  &lt;br /&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Helvetica; font-size: small;"&gt;Some of you may find yourselves in situations where you may need to develop in Python but are limited by the existing geoprocessing methods available.&amp;nbsp; Luckily, there is a method of accessing the ArcObject COM libraries through Python.&amp;nbsp; The &lt;a href="http://starship.python.net/crew/theller/comtypes/" target="_blank"&gt;comtypes&lt;/a&gt; package allows you use all of the methods available to .NET developers.&amp;nbsp; The presentation &lt;a href="http://www.pierssen.com/arcgis/upload/misc/python_arcobjects.pdf" target="_blank"&gt;Using ArcObjects in Python&lt;/a&gt; gives an excellent overview of how to accomplish this. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Helvetica; font-size: small;"&gt;I’m going to walk you through a specific example using comtypes.&amp;nbsp; In this example, we will perform a coordinate conversion on a point from a Geographic Coordinate System to a Projected Coordinate System.&amp;nbsp; To get started, &lt;a href="http://sourceforge.net/projects/comtypes/" target="_blank"&gt;download&lt;/a&gt; and install comtypes.&amp;nbsp; Once this is complete it’s time to start coding.&amp;nbsp; We’ll start off by defining four functions.&amp;nbsp; These will make more sense later.&amp;nbsp; First get the COM library path:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="color: orange;"&gt;def&lt;/span&gt; &lt;span style="color: blue;"&gt;GetLibPath&lt;/span&gt;():&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp; &lt;span style="color: orange;"&gt;import&lt;/span&gt; _winreg&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp; keyESRI =&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE,&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&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; &lt;span style="color: #38761d;"&gt;"SOFTWARE\\ESRI\\ArcGIS"&lt;/span&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Helvetica; font-size: small;"&gt;&lt;span style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp; &lt;span style="color: orange;"&gt;return&lt;/span&gt; _winreg.QueryValueEx(keyESRI, &lt;span style="color: #38761d;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: Helvetica; font-size: small;"&gt;&lt;span style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="color: #38761d;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "InstallDir"&lt;/span&gt;)[0] + &lt;span style="color: #38761d;"&gt;"com\\"&lt;/span&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Helvetica; font-size: small;"&gt;Next we need to create a procedure to get the ArcObjects module:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="color: orange;"&gt;def&lt;/span&gt; &lt;span style="color: blue;"&gt;GetModule&lt;/span&gt;(sModuleName):&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp; &lt;span style="color: orange;"&gt;import&lt;/span&gt; comtypes&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp; &lt;span style="color: orange;"&gt;import&lt;/span&gt; comtypes.client &lt;span style="color: orange;"&gt;as&lt;/span&gt; comc&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp; sLibPath = GetLibPath()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Helvetica; font-size: small;"&gt;&lt;span style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;comc.GetModule(sLibPath + sModuleName)&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Helvetica; font-size: small;"&gt;Create a function that creates a new object:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="color: orange;"&gt;def&lt;/span&gt; &lt;span style="color: blue;"&gt;NewObj&lt;/span&gt;(MyClass, MyInterface):&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp; &lt;span style="color: orange;"&gt;import&lt;/span&gt; comtypes&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp; &lt;span style="color: orange;"&gt;try&lt;/span&gt;:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ptr = comtypes.client.CreateObject(MyClass,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&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; interface=MyInterface)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: orange;"&gt;return&lt;/span&gt; ptr&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp; &lt;span style="color: orange;"&gt;except&lt;/span&gt;:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Helvetica; font-size: small;"&gt;&lt;span style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: orange;"&gt;return&lt;/span&gt; None&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Helvetica; font-size: small;"&gt;Finally, create a function for casting objects:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="color: orange;"&gt;def&lt;/span&gt; &lt;span style="color: blue;"&gt;CType&lt;/span&gt;(obj, interface):&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp; &lt;span style="color: orange;"&gt;try&lt;/span&gt;:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; newobj = obj.QueryInterface(interface)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: orange;"&gt;return&lt;/span&gt; newobj&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp; &lt;span style="color: orange;"&gt;except&lt;/span&gt;:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Helvetica; font-size: small;"&gt;&lt;span style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: orange;"&gt;return&lt;/span&gt; &lt;span style="color: purple;"&gt;None&lt;/span&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Helvetica; font-size: small;"&gt;Now we need to define the main function to perform the coordinate transformation:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Helvetica; font-size: small;"&gt;&lt;span style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="color: orange;"&gt;def&lt;/span&gt; &lt;span style="color: blue;"&gt;TransformCoords&lt;/span&gt;(x, y, gcs, pcs, trans, direction):&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Helvetica; font-size: small;"&gt;The x and y are the longitude and latitude of the point in decimal degrees.&amp;nbsp; In order to perform transformation you will need to look up some ESRI codes.&amp;nbsp; The list of geographic coordinate system codes are here: &lt;a href="http://edndoc.esri.com/arcobjects/9.2/ComponentHelp/esriGeometry/esriSRGeoCSType.htm" target="_blank"&gt;Page 1&lt;/a&gt;, &lt;a href="http://edndoc.esri.com/arcobjects/9.2/ComponentHelp/esriGeometry/esriSRGeoCS2Type.htm" target="_blank"&gt;Page 2&lt;/a&gt;, &lt;a href="http://edndoc.esri.com/arcobjects/9.2/ComponentHelp/esriGeometry/esriSRGeoCS3Type.htm" target="_blank"&gt;Page 3&lt;/a&gt;.&amp;nbsp; The projected coordinate systems are here: &lt;a href="http://edndoc.esri.com/arcobjects/9.2/ComponentHelp/esriGeometry/esriSRProjCSType.htm" target="_blank"&gt;Page 1&lt;/a&gt;, &lt;a href="http://edndoc.esri.com/arcobjects/9.2/ComponentHelp/esriGeometry/esriSRProjCS2Type.htm" target="_blank"&gt;Page 2&lt;/a&gt;, &lt;a href="http://edndoc.esri.com/arcobjects/9.2/ComponentHelp/esriGeometry/esriSRProjCS3Type.htm" target="_blank"&gt;Page 3&lt;/a&gt;, &lt;a href="http://edndoc.esri.com/arcobjects/9.2/ComponentHelp/esriGeometry/esriSRProjCS4Type.htm" target="_blank"&gt;Page 4&lt;/a&gt;.&amp;nbsp; And the transformations are here: &lt;a href="http://edndoc.esri.com/arcobjects/9.2/ComponentHelp/esriGeometry/esriSRGeoTransformationType.htm" target="_blank"&gt;Page 1&lt;/a&gt;, &lt;a href="http://edndoc.esri.com/arcobjects/9.2/ComponentHelp/esriGeometry/esriSRGeoTransformation2Type.htm" target="_blank"&gt;Page 2&lt;/a&gt;, &lt;a href="http://edndoc.esri.com/arcobjects/9.2/ComponentHelp/esriGeometry/esriSRGeoTransformation3Type.htm" target="_blank"&gt;Page 3&lt;/a&gt;. &amp;nbsp;&amp;nbsp;Lastly, you’ll need the direction codes &lt;a href="http://edndoc.esri.com/arcobjects/9.2/ComponentHelp/esriGeometry/esriTransformDirection.htm" target="_blank"&gt;here&lt;/a&gt;.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Helvetica; font-size: small;"&gt;For those familiar with writing ArcObjects in C# I will include the C# equivalent with each piece of code.&amp;nbsp; Now we need to get the Geometry module and import it:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;GetModule(&lt;span style="color: #38761d;"&gt;"esriGeometry.olb"&lt;/span&gt;)&lt;/span&gt;&lt;o:p style="color: black;"&gt;&lt;/o:p&gt;&lt;span style="color: black;"&gt;&lt;span style="color: orange;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style="font-family: Helvetica; font-size: small;"&gt;&lt;span style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="color: orange;"&gt;&amp;nbsp;&amp;nbsp; import&lt;/span&gt; comtypes.gen.esriGeometry &lt;span style="color: orange;"&gt;as&lt;/span&gt; esriGeometry&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Helvetica; font-size: small;"&gt;&lt;b&gt;C#:&lt;/b&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="color: blue; font-family: Helvetica; font-size: small;"&gt;using&lt;/span&gt;&lt;span style="font-family: Helvetica; font-size: small;"&gt;&lt;span style="color: black; font-family: Verdana,sans-serif;"&gt; ESRI.ArcGIS.Geometry;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Helvetica; font-size: small;"&gt;Next we create a new point object and assign the x and y values:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="color: black;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: black;"&gt;point = NewObj(esriGeometry.Point,&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;&lt;span style="color: black;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; esriGeometry.IPoint)&lt;/span&gt;&lt;o:p style="color: black;"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp; point.X = x&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Helvetica; font-size: small;"&gt;&lt;span style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp; point.Y = y&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;div style="font-family: &amp;quot;Helvetica Neue&amp;quot;,Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;&lt;b&gt;C#:&lt;/b&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="color: black; font-family: Verdana,sans-serif;"&gt;&lt;span style="color: #6fa8dc; font-size: small;"&gt;Point&lt;/span&gt;&lt;span style="font-size: small;"&gt; point = &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: #6fa8dc;"&gt;Point&lt;/span&gt;();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="color: black; font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;point.X = x;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="color: black; font-family: Helvetica; font-size: small;"&gt;point.Y = y;&lt;/span&gt;&lt;span style="font-family: Helvetica; font-size: small;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Helvetica; font-size: small;"&gt;It’s time to start using the codes we looked up.&amp;nbsp; Let’s define the spatial reference for the geographic coordinate system:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp; sRefEnv =&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NewObj(esriGeometry.SpatialReferenceEnvironment,&lt;/span&gt;&lt;/div&gt;&lt;div style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; esriGeometry.ISpatialReferenceFactory)&lt;/span&gt;&lt;/div&gt;&lt;div style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp; incomingCoordSystem =&lt;/span&gt;&lt;/div&gt;&lt;div style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp; CType(sRefEnv.CreateGeographicCoordinateSystem(gcs),&lt;/span&gt;&lt;/div&gt;&lt;div style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; esriGeometry.ISpatialReference)&lt;br /&gt;&amp;nbsp;&amp;nbsp; point.SpatialReference = incomingCoordSystem&lt;/span&gt;&lt;/div&gt;&lt;span style="font-family: Helvetica; font-size: small;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style="font-family: Helvetica; font-size: small;"&gt;&lt;span style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Helvetica; font-size: small;"&gt;&lt;b&gt;C#:&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: Helvetica; font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="color: #6fa8dc;"&gt;SpatialReferenceEnvironment&lt;/span&gt; sRefEnv = &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: #6fa8dc;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: Helvetica; font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="color: #6fa8dc;"&gt;&amp;nbsp;&amp;nbsp; SpatialReferenceEnvironment&lt;/span&gt;(); &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="color: black; font-family: Verdana,sans-serif; margin-left: 3.25in; text-indent: -3.25in;"&gt;&lt;span style="color: #6fa8dc; font-size: small;"&gt;ISpatialReference&lt;/span&gt;&lt;span style="font-size: small;"&gt; incomingCoordSystem =&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="color: black; font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp; sRefEnv.CreateGeographicCoordinateSystem(gcs);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Helvetica; font-size: small;"&gt;&lt;span style="color: black; font-family: Verdana,sans-serif;"&gt;point.SpatialReference = incomingCoordSystem;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Helvetica; font-size: small;"&gt;Define the projected coordinate system:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp; outgoingCoordSystem =&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp; CType(sRefEnv.CreateProjectedCoordinateSystem(pcs),&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; esriGeometry.ISpatialReference)&lt;/span&gt;&lt;/div&gt;&lt;span style="font-family: Helvetica; font-size: small;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: Helvetica; font-size: small;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="margin-left: 2in; text-indent: -2in;"&gt;&lt;span style="font-family: Helvetica; font-size: small;"&gt;&lt;b&gt;C#:&lt;/b&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="color: #2b91af; font-family: Helvetica; font-size: small;"&gt;ISpatialReference&lt;/span&gt;&lt;span style="font-family: Helvetica; font-size: small;"&gt;&lt;span style="color: black; font-family: Verdana,sans-serif;"&gt; outgoingCoordSystem =&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: Helvetica; font-size: small;"&gt;&lt;span style="color: black; font-family: Verdana,sans-serif;"&gt;sRefEnv.CreateProjectedCoordinateSystem(pcs);&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: Helvetica; font-size: small;"&gt;&lt;br /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="margin-left: 2in; text-indent: -2in;"&gt;&lt;div style="font-family: &amp;quot;Helvetica Neue&amp;quot;,Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;Define the geographic transformation:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp; geoTransformation =&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CType(sRefEnv.CreateGeoTransformation(trans),&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; esriGeometry.IGeoTransformation)&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Helvetica; font-size: small;"&gt;&lt;b&gt;C#:&lt;/b&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="color: #2b91af; font-family: Helvetica; font-size: small;"&gt;IGeoTransformation&lt;/span&gt;&lt;span style="font-family: Helvetica; font-size: small;"&gt;&lt;span style="color: black; font-family: Verdana,sans-serif;"&gt; geoTransformation =&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: Helvetica; font-size: small;"&gt;&lt;span style="color: black; font-family: Verdana,sans-serif;"&gt;(&lt;/span&gt;&lt;span style="color: #2b91af; font-family: Verdana,sans-serif;"&gt;IGeoTransformation&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif;"&gt;)sRefEnv.CreateGeoTransformation(trans);&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Helvetica; font-size: small;"&gt;Re-project the coordinates and assign the new geometry to the point:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;geometry = CType(point, esriGeometry.IGeometry2)&lt;/span&gt;&lt;o:p style="color: black;"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp; geometry.ProjectEx(outgoingCoordSystem,&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; direction,geoTransformation, &lt;span style="color: #a64d79;"&gt;False&lt;/span&gt;, 0, 0)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Helvetica; font-size: small;"&gt;&lt;span style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp; point = CType(geometry, esriGeometry.IPoint)&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Helvetica; font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Helvetica; font-size: small;"&gt;&lt;b&gt;C#:&lt;/b&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="color: black; font-family: Verdana,sans-serif;"&gt;&lt;span style="color: #6fa8dc; font-size: small;"&gt;IGeometry2&lt;/span&gt;&lt;span style="font-size: small;"&gt; geometry = point &lt;span style="color: blue;"&gt;as&lt;/span&gt; &lt;span style="color: #6fa8dc;"&gt;IGeometry2&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="color: black; font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;geometry.ProjectEx(outgoingCoordSystem, &lt;span style="color: #6fa8dc;"&gt;esriTransformDirection&lt;/span&gt;.esriTransformForward, geoTransformation,&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;&lt;span style="color: blue;"&gt;&amp;nbsp;&amp;nbsp; false&lt;/span&gt;, 0, 0);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Helvetica; font-size: small;"&gt;&lt;span style="color: black; font-family: Verdana,sans-serif;"&gt;point = (&lt;/span&gt;&lt;span style="color: #2b91af; font-family: Verdana,sans-serif;"&gt;Point&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif;"&gt;)geometry;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Helvetica; font-size: small;"&gt;Finally, assign the coordinates to an array and return them:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="color: black;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: black;"&gt;points = [point.X, point.Y]&lt;/span&gt;&lt;o:p style="color: black;"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Helvetica; font-size: small;"&gt;&lt;span style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp; &lt;span style="color: orange;"&gt;return&lt;/span&gt; points&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Helvetica;"&gt;&lt;span style="font-size: small;"&gt;In the end you have an array of the transformed x and y of the original point.&amp;nbsp; Another method exists that can also be helpful called &lt;a href="http://python.net/crew/theller/ctypes/" target="_blank"&gt;ctypes&lt;/a&gt;.&amp;nbsp; With ctypes, you can access C libraries much like comtypes.&amp;nbsp; An excellent example of transformation using ctypes can be found &lt;a href="http://gissolved.blogspot.com/2009/04/projections-and-transformations-with.html" target="_blank"&gt;here&lt;/a&gt;.&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1685715839413080921-7596184322557169817?l=developmentfaction.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://developmentfaction.blogspot.com/feeds/7596184322557169817/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://developmentfaction.blogspot.com/2010/05/using-arcobjects-for-coordinate.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1685715839413080921/posts/default/7596184322557169817'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1685715839413080921/posts/default/7596184322557169817'/><link rel='alternate' type='text/html' href='http://developmentfaction.blogspot.com/2010/05/using-arcobjects-for-coordinate.html' title='Using ArcObjects for coordinate transformations in Python'/><author><name>Scott M. Wiegand</name><uri>http://www.blogger.com/profile/04254954827022015613</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='25' src='http://4.bp.blogspot.com/_E5RVVgOhCb0/S_MU2SyRQ3I/AAAAAAAAAJs/lwlXRVm9Dfk/S220/globe_logo.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1685715839413080921.post-7130343329893003209</id><published>2010-05-24T09:50:00.000-07:00</published><updated>2010-07-14T06:37:21.396-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='geoprocessing'/><category scheme='http://www.blogger.com/atom/ns#' term='ArcSDE'/><category scheme='http://www.blogger.com/atom/ns#' term='cx_Oracle'/><category scheme='http://www.blogger.com/atom/ns#' term='Oracle'/><category scheme='http://www.blogger.com/atom/ns#' term='ArcObjects'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL'/><category scheme='http://www.blogger.com/atom/ns#' term='Python'/><category scheme='http://www.blogger.com/atom/ns#' term='ESRI'/><title type='text'>Using Python to access ArcSDE data faster with cx_Oracle</title><content type='html'>&lt;o:smarttagtype name="State" namespaceuri="urn:schemas-microsoft-com:office:smarttags"&gt;&lt;/o:smarttagtype&gt;&lt;o:smarttagtype name="place" namespaceuri="urn:schemas-microsoft-com:office:smarttags"&gt;&lt;/o:smarttagtype&gt;&lt;style&gt;&lt;!-- /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:""; margin:0in; margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman";}@page Section1 {size:8.5in 11.0in; margin:1.0in 1.25in 1.0in 1.25in; mso-header-margin:.5in; mso-footer-margin:.5in; mso-paper-source:0;}div.Section1 {page:Section1;}--&gt;&lt;/style&gt;  &lt;br /&gt;&lt;div class="MsoNormal" style="font-family: &amp;quot;Helvetica Neue&amp;quot;,Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;Using Python and ArcObjects to access data can be painfully slow, especially with large amounts of data.&amp;nbsp; However, there is another method for accessing data from Oracle that will allow your scripts to run faster.&amp;nbsp; The Python extension module, cx_Oracle, allows you to access an Oracle database without using ArcObjects.&amp;nbsp; Using cx_Orcale you can quickly query and modify attributes for tables and feature classes in ArcSDE.&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="font-family: &amp;quot;Helvetica Neue&amp;quot;,Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="font-family: &amp;quot;Helvetica Neue&amp;quot;,Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;NOTE:&amp;nbsp; Do NOT attempt to modify (INSERT, UPDATE, DELETE, etc) a table or feature class that is registered as versioned.&amp;nbsp; The results are unpredictable at best and can result in data loss.&amp;nbsp; However, you can safely SELECT any table or feature class.&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="font-family: &amp;quot;Helvetica Neue&amp;quot;,Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="font-family: &amp;quot;Helvetica Neue&amp;quot;,Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;To start you’ll need to download the cx_Oracle module &lt;a href="http://cx-oracle.sourceforge.net/" target="_blank"&gt;here&lt;/a&gt;.&amp;nbsp; Once you have it installed and are ready to write some code, begin by importing the cx_Oracle module:&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="font-family: &amp;quot;Helvetica Neue&amp;quot;,Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&lt;b style="color: orange;"&gt;import&lt;/b&gt; cx_Oracle&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="font-family: &amp;quot;Helvetica Neue&amp;quot;,Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="font-family: &amp;quot;Helvetica Neue&amp;quot;,Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;Next we need to connect to the Oracle database.&amp;nbsp; There are several ways to do this.&amp;nbsp; For a complete reference, see the cx_Oracle &lt;a href="http://cx-oracle.sourceforge.net/html/index.html" target="_blank"&gt;documentation&lt;/a&gt;.&amp;nbsp; In this example we first create a DSN:&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="font-family: &amp;quot;Helvetica Neue&amp;quot;,Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="font-family: &amp;quot;Helvetica Neue&amp;quot;,Arial,Helvetica,sans-serif;"&gt;&lt;div style="color: black;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;dsn = cx_Oracle.makedsn("gisdb01.devfaction.com",&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style="font-size: small;"&gt;&lt;span style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "1521", "gisdb")&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="font-family: &amp;quot;Helvetica Neue&amp;quot;,Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="font-family: &amp;quot;Helvetica Neue&amp;quot;,Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;In this example, gisdb01.devfaction.com is the host, 1521 is the port, and gisdb is the name of the database.&amp;nbsp; Once the DSN is created, we connect to the database using the DSN:&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="font-family: &amp;quot;Helvetica Neue&amp;quot;,Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;orcl = cx_Oracle.connect('', '', dsn)&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="font-family: &amp;quot;Helvetica Neue&amp;quot;,Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="font-family: &amp;quot;Helvetica Neue&amp;quot;,Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;Now that we are connected to the database, we need to create a cursor:&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="font-family: &amp;quot;Helvetica Neue&amp;quot;,Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="font-family: &amp;quot;Helvetica Neue&amp;quot;,Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;cursor = orcl.cursor()&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="font-family: &amp;quot;Helvetica Neue&amp;quot;,Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="font-family: &amp;quot;Helvetica Neue&amp;quot;,Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;The next step is to create a SQL statement to execute.&amp;nbsp; This statement can be any SQL syntax that Oracle supports.&amp;nbsp; We will start off with a simple SELECT statement:&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="font-family: &amp;quot;Helvetica Neue&amp;quot;,Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;sql = &lt;/span&gt;&lt;span style="color: #38761d; font-size: small;"&gt;"SELECT id, name FROM DB.ROADS WHERE id &amp;lt; 10"&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="font-family: &amp;quot;Helvetica Neue&amp;quot;,Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="font-family: &amp;quot;Helvetica Neue&amp;quot;,Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;This statement will return two fields from the ROADS table where the ID is less than 10.&amp;nbsp; Now it’s time to execute the statement:&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="font-family: &amp;quot;Helvetica Neue&amp;quot;,Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="font-family: &amp;quot;Helvetica Neue&amp;quot;,Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;cursor.execute(sql)&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="font-family: &amp;quot;Helvetica Neue&amp;quot;,Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="font-family: &amp;quot;Helvetica Neue&amp;quot;,Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;Now that we have run a query, we need to use the data that was returned.&amp;nbsp; To this we can loop through each row in the cursor:&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="font-family: &amp;quot;Helvetica Neue&amp;quot;,Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&lt;b style="color: orange;"&gt;for&lt;/b&gt; row &lt;b style="color: orange;"&gt;in&lt;/b&gt; cursor:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;b style="color: orange;"&gt;print&lt;/b&gt; row[0] + &lt;/span&gt;&lt;span style="font-size: small;"&gt;", "&lt;/span&gt;&lt;span style="font-size: small;"&gt; + row[1]&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="font-family: &amp;quot;Helvetica Neue&amp;quot;,Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="font-family: &amp;quot;Helvetica Neue&amp;quot;,Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;The results should look something like this:&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="font-family: &amp;quot;Helvetica Neue&amp;quot;,Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;1, Walnut&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;2, Oak&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;3, Spruce&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="font-family: &amp;quot;Helvetica Neue&amp;quot;,Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="font-family: &amp;quot;Helvetica Neue&amp;quot;,Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;When you are finished remember to delete the cursor and close your connection:&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="font-family: &amp;quot;Helvetica Neue&amp;quot;,Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&lt;b style="color: orange;"&gt;&lt;st1:place w:st="on"&gt;&lt;st1:state w:st="on"&gt;del&lt;/st1:state&gt;&lt;/st1:place&gt;&lt;/b&gt; cursor&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;orcl.close()&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="font-family: &amp;quot;Helvetica Neue&amp;quot;,Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="font-family: &amp;quot;Helvetica Neue&amp;quot;,Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;You can also delete and modify data using cx_Oracle.&amp;nbsp; It may be possible to INSERT new records but it is not recommended for ArcSDE objects.&amp;nbsp; Follow the same steps to create the connection and cursor then create a SQL statement and execute it.:&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="font-family: &amp;quot;Helvetica Neue&amp;quot;,Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;sql = &lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="color: #38761d;"&gt;"UPDATE DB.ROADS SET name = '1st' "&lt;/span&gt; +\&lt;/span&gt;&lt;br /&gt;&lt;div&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: #38761d;"&gt;"WHERE id = 3"&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="font-family: &amp;quot;Helvetica Neue&amp;quot;,Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;cursor.execute(sql)&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="font-family: &amp;quot;Helvetica Neue&amp;quot;,Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="font-family: &amp;quot;Helvetica Neue&amp;quot;,Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;You will need to commit your changes before closing the connection:&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="font-family: &amp;quot;Helvetica Neue&amp;quot;,Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="color: black; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;orcl.commit()&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="font-family: &amp;quot;Helvetica Neue&amp;quot;,Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="font-family: &amp;quot;Helvetica Neue&amp;quot;,Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;In addition to creating scripts that run faster, cx_Oracle can help users who are more familiar with writing SQL than using ArcObjects.&amp;nbsp; But I want to reiterate one more time that modifications should not be performed on feature classes or tables that are registered as versioned.&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="font-family: &amp;quot;Helvetica Neue&amp;quot;,Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="font-family: &amp;quot;Helvetica Neue&amp;quot;,Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;cx_Oracle consists of many more useful functions.&amp;nbsp; I encourage you to read through the &lt;a href="http://cx-oracle.sourceforge.net/html/index.html" target="_blank"&gt;documentation&lt;/a&gt; and see what else exists.&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1685715839413080921-7130343329893003209?l=developmentfaction.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://developmentfaction.blogspot.com/feeds/7130343329893003209/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://developmentfaction.blogspot.com/2010/05/using-python-to-access-arcsde-data.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1685715839413080921/posts/default/7130343329893003209'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1685715839413080921/posts/default/7130343329893003209'/><link rel='alternate' type='text/html' href='http://developmentfaction.blogspot.com/2010/05/using-python-to-access-arcsde-data.html' title='Using Python to access ArcSDE data faster with cx_Oracle'/><author><name>Scott M. Wiegand</name><uri>http://www.blogger.com/profile/04254954827022015613</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='25' src='http://4.bp.blogspot.com/_E5RVVgOhCb0/S_MU2SyRQ3I/AAAAAAAAAJs/lwlXRVm9Dfk/S220/globe_logo.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1685715839413080921.post-7161101440594133283</id><published>2010-05-20T14:11:00.000-07:00</published><updated>2010-05-21T15:13:27.983-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Development Faction Company Info'/><title type='text'>Development Faction Company Info</title><content type='html'>Established in 2009, Development Faction, LLC is the collective vision of several industry professionals highly skilled in the disciplines of Geospatial Information, Software Design &amp;amp; Development, Database Design / Management, Web Design &amp;amp; Implementation, and Project Management.&lt;br /&gt;&lt;br /&gt;               With a combined experience of over 20 years in the industry, Development Faction possesses the knowledge                 to evaluate, plan, and strategically implement custom tailored solutions to meet our customer’s needs.                &lt;br /&gt;&lt;br /&gt;Our unique business structure and well rounded skill set awards us the opportunity to handle projects of any size / complexity by eliminating the use of sub-consultants.&lt;br /&gt;&lt;br /&gt;Our esteemed staff is well versed in using the industry standard commercial-off-the-shelf (COTS) software packages, developing custom software / applications, and open source software packages; therefore Development Faction can fulfill our customer’s needs in the most cost efficient manner.&lt;br /&gt;&lt;br /&gt;Development Faction is &lt;span style="font-size:100%;"&gt;&lt;span class="UIStory_Message"&gt;an official Microsoft® BizSpark™ software development start-up firm&lt;/span&gt;&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;For more information on Development Faction, visit our website:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.devfaction.com/"&gt;http://www.devfaction.com&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;or contact us:&lt;br /&gt;&lt;br /&gt;&lt;a href="mailto:info@devfaction.com"&gt;info@devfaction.com&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1685715839413080921-7161101440594133283?l=developmentfaction.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://developmentfaction.blogspot.com/feeds/7161101440594133283/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://developmentfaction.blogspot.com/2010/05/development-faction-company-info.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1685715839413080921/posts/default/7161101440594133283'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1685715839413080921/posts/default/7161101440594133283'/><link rel='alternate' type='text/html' href='http://developmentfaction.blogspot.com/2010/05/development-faction-company-info.html' title='Development Faction Company Info'/><author><name>Matthew Smith</name><uri>http://www.blogger.com/profile/05211425782524528535</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='25' src='http://3.bp.blogspot.com/_1P0cINhGrTo/S_MgviHjHvI/AAAAAAAAAAM/nNL_GKpZZVY/S220/globe_logo.png'/></author><thr:total>0</thr:total></entry></feed>
