<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Arne&#039;s Adventures in GIS</title>
	<atom:link href="http://mygisblog.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://mygisblog.wordpress.com</link>
	<description>A Blog About Teaching Myself GIS...</description>
	<lastBuildDate>Fri, 06 Jan 2012 23:52:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='mygisblog.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Arne&#039;s Adventures in GIS</title>
		<link>http://mygisblog.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://mygisblog.wordpress.com/osd.xml" title="Arne&#039;s Adventures in GIS" />
	<atom:link rel='hub' href='http://mygisblog.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Python Standard LIbrary &#8211; Book</title>
		<link>http://mygisblog.wordpress.com/2012/01/06/python-standard-library-book/</link>
		<comments>http://mygisblog.wordpress.com/2012/01/06/python-standard-library-book/#comments</comments>
		<pubDate>Fri, 06 Jan 2012 23:49:43 +0000</pubDate>
		<dc:creator>Arne</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[book]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[review]]></category>
		<category><![CDATA[Standard LIbrary]]></category>

		<guid isPermaLink="false">http://mygisblog.wordpress.com/?p=700</guid>
		<description><![CDATA[Working in Python, I find myself googling for solutions to programming snags all the time. More and more often, my questions turn out to be about use of the Python Standard Library, be it hashlib for file comparison purposes or &#8230; <a href="http://mygisblog.wordpress.com/2012/01/06/python-standard-library-book/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mygisblog.wordpress.com&amp;blog=3561924&amp;post=700&amp;subd=mygisblog&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://mygisblog.files.wordpress.com/2012/01/python_standardlib1.jpg"><img class="alignleft size-full wp-image-701" style="margin:10px;" title="Python_StandardLib" src="http://mygisblog.files.wordpress.com/2012/01/python_standardlib1.jpg?w=500" alt=""   /></a>Working in Python, I find myself googling for solutions to programming snags all the time. More and more often, my questions turn out to be about use of the Python Standard Library, be it <em>hashlib</em> for file comparison purposes or <em>shutil </em>for standard file system operations, or whatever. So I finally took the plunge and placed the Standard Library on my desk &#8211; the Addison-Wesley Professional/Developers Library text. I&#8217;ve said before, I learn more from reading 2 pages in a book than googling 20 pages.</p>
<p>This is not a beginners book on how to learn Python. This is the book you need, being the bookish type, if you use Python every day and would like to learn to finer details of how to use the standard modules effectively. This is a great book to just browse and start reading anywhere. I promise you that you will learn a lot.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mygisblog.wordpress.com/700/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mygisblog.wordpress.com/700/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mygisblog.wordpress.com/700/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mygisblog.wordpress.com/700/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mygisblog.wordpress.com/700/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mygisblog.wordpress.com/700/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mygisblog.wordpress.com/700/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mygisblog.wordpress.com/700/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mygisblog.wordpress.com/700/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mygisblog.wordpress.com/700/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mygisblog.wordpress.com/700/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mygisblog.wordpress.com/700/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mygisblog.wordpress.com/700/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mygisblog.wordpress.com/700/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mygisblog.wordpress.com&amp;blog=3561924&amp;post=700&amp;subd=mygisblog&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mygisblog.wordpress.com/2012/01/06/python-standard-library-book/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/75b76f2b585ad16a98fe1ae050a820be?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Arne</media:title>
		</media:content>

		<media:content url="http://mygisblog.files.wordpress.com/2012/01/python_standardlib1.jpg" medium="image">
			<media:title type="html">Python_StandardLib</media:title>
		</media:content>
	</item>
		<item>
		<title>ArcSDE Revisited</title>
		<link>http://mygisblog.wordpress.com/2011/09/30/arcsde-revisited/</link>
		<comments>http://mygisblog.wordpress.com/2011/09/30/arcsde-revisited/#comments</comments>
		<pubDate>Fri, 30 Sep 2011 22:25:36 +0000</pubDate>
		<dc:creator>Arne</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[ArcSDE]]></category>

		<guid isPermaLink="false">http://mygisblog.wordpress.com/?p=695</guid>
		<description><![CDATA[I stumbled upon my post from this spring about ArcSDE. Well, I&#8217;ve since had the opportunity to get to know SDE a little better. I installed ArcSDE 10 and created a geodatabase in SQL Server 2008. I haven&#8217;t pushed a &#8230; <a href="http://mygisblog.wordpress.com/2011/09/30/arcsde-revisited/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mygisblog.wordpress.com&amp;blog=3561924&amp;post=695&amp;subd=mygisblog&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I stumbled upon my post from this spring <a href="http://mygisblog.wordpress.com/2011/05/17/whenwhowhy-arcsde/">about ArcSDE</a>. Well, I&#8217;ve since had the opportunity to get to know SDE a little better. I installed ArcSDE 10 and created a geodatabase in SQL Server 2008. I haven&#8217;t pushed a lot of data into SDE since, mainly because I have been trying to come up with a good plan of how to structure our geospatial data, which will be accessed by both ArcGIS Server and other Non-ESRI applications, e.g. <a href="http://www.landworks.com/products/landworks-property-management.asp">LandWorks Property Management (LPM)</a>. Once I&#8217;ve completed my analysis, it will be time to start moving data. During all my reading and googling on ArcSDE/SQL Server functionality and configuration though, I again lament ESRI&#8217;s decision not to update the PDF documents that they were still issuing for most ArcGIS 9.3 products. I find it so much easier to read a chapter in a book-like PDF file than trying to do so in the online or on-disk help file, hampered by constantly expanding and collapsing bullets and distracting links. But maybe that&#8217;s just me.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mygisblog.wordpress.com/695/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mygisblog.wordpress.com/695/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mygisblog.wordpress.com/695/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mygisblog.wordpress.com/695/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mygisblog.wordpress.com/695/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mygisblog.wordpress.com/695/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mygisblog.wordpress.com/695/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mygisblog.wordpress.com/695/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mygisblog.wordpress.com/695/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mygisblog.wordpress.com/695/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mygisblog.wordpress.com/695/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mygisblog.wordpress.com/695/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mygisblog.wordpress.com/695/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mygisblog.wordpress.com/695/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mygisblog.wordpress.com&amp;blog=3561924&amp;post=695&amp;subd=mygisblog&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mygisblog.wordpress.com/2011/09/30/arcsde-revisited/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/75b76f2b585ad16a98fe1ae050a820be?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Arne</media:title>
		</media:content>
	</item>
		<item>
		<title>FME Desktop 2011 Class &#8211; Safe Software, Vancouver</title>
		<link>http://mygisblog.wordpress.com/2011/09/30/fme-desktop-2011-class-safe-software-vancouver/</link>
		<comments>http://mygisblog.wordpress.com/2011/09/30/fme-desktop-2011-class-safe-software-vancouver/#comments</comments>
		<pubDate>Fri, 30 Sep 2011 21:04:38 +0000</pubDate>
		<dc:creator>Arne</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[FME Desktop vs. ESRI ModelBuilder]]></category>
		<category><![CDATA[review]]></category>
		<category><![CDATA[Safe Software]]></category>

		<guid isPermaLink="false">http://mygisblog.wordpress.com/?p=687</guid>
		<description><![CDATA[I recently had the pleasure of escaping the Texas summer heat and traveling to Vancouver, BC, for a Safe Software training class. I had stopped at the Safe Software booth at ESRI UC for a few minutes this July, and &#8230; <a href="http://mygisblog.wordpress.com/2011/09/30/fme-desktop-2011-class-safe-software-vancouver/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mygisblog.wordpress.com&amp;blog=3561924&amp;post=687&amp;subd=mygisblog&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:left;"><a href="http://mygisblog.files.wordpress.com/2011/09/safe-logo-top.gif"><img class="alignleft size-full wp-image-689" title="safe-logo-top" src="http://mygisblog.files.wordpress.com/2011/09/safe-logo-top.gif?w=500" alt=""   /></a>I recently had the pleasure of escaping the Texas summer heat and traveling to Vancouver, BC, for a Safe Software training class. I had stopped at the Safe Software booth at ESRI UC for a few minutes this July, and one of their reps gave me a quick intro to FME Desktop. Well, one thing led to another, and before I knew it, I was signed up for the class.</p>
<p>I haven&#8217;t taken a whole lot of similar classes but enough to know which ones are a failure, and which ones are worth your time. The one for FME Desktop 2011 was one of the best I&#8217;ve taken. In fact, I couldn&#8217;t help myself and had to rave to the friends at Safe about it. So let me quote from my own email:</p>
<p><span style="color:#333399;">First of all, let me share with you that I found the FME Desktop class to be top-notch ! I have taken a few similar classes or workshops in the past and this one stands out. Not only did I get the impression that [the instructor] really knows her stuff never mind the occasional FATAL ERROR <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  but the format of the class (30 minutes teaching, 10 minutes hands-on), plus the quality of the manual, made for a real good package that I would recommend to anyone interested in FME. Well done ! &#8212;  That said, I think FME is fantastic. I think I mentioned to both of you that I have pulled my hair out trying to wrap my brain around ESRI&#8217;s ModelBuilder more than once. FME makes more sense to me, is a lot more intuitive to my thinking and the work flows I deal with &#8230;</span></p>
<p>So, there you have it. If you haven&#8217;t taken a look at FME and deal with lots of ETL (extraction-transformation-loading) procedures, then this may be for you. Funny thing is (and I think both instructor and manual shared this with us), they say, that 90% of all FME transformations consist of shapefile &gt;&gt;&gt; shapefile conversion e.g. reprojection, adding attributes&#8230; What does that say about ArcGIS if people use FME to transform shapefiles  ? I&#8217;ve certainly tried to use ModelBuilder more than once, and every time I found that is was much easier and straight forward to just write things out in Python. With FME, I felt that &#8211; while things can get very complex &#8211; the approach stays very clear and intuitive.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mygisblog.wordpress.com/687/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mygisblog.wordpress.com/687/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mygisblog.wordpress.com/687/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mygisblog.wordpress.com/687/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mygisblog.wordpress.com/687/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mygisblog.wordpress.com/687/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mygisblog.wordpress.com/687/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mygisblog.wordpress.com/687/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mygisblog.wordpress.com/687/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mygisblog.wordpress.com/687/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mygisblog.wordpress.com/687/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mygisblog.wordpress.com/687/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mygisblog.wordpress.com/687/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mygisblog.wordpress.com/687/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mygisblog.wordpress.com&amp;blog=3561924&amp;post=687&amp;subd=mygisblog&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mygisblog.wordpress.com/2011/09/30/fme-desktop-2011-class-safe-software-vancouver/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/75b76f2b585ad16a98fe1ae050a820be?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Arne</media:title>
		</media:content>

		<media:content url="http://mygisblog.files.wordpress.com/2011/09/safe-logo-top.gif" medium="image">
			<media:title type="html">safe-logo-top</media:title>
		</media:content>
	</item>
		<item>
		<title>Getting PETRA well bore paths into ArcMAP using Python</title>
		<link>http://mygisblog.wordpress.com/2011/09/22/getting-petra-well-bore-paths-into-arcmap-using-python/</link>
		<comments>http://mygisblog.wordpress.com/2011/09/22/getting-petra-well-bore-paths-into-arcmap-using-python/#comments</comments>
		<pubDate>Thu, 22 Sep 2011 22:20:39 +0000</pubDate>
		<dc:creator>Arne</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Arcmap]]></category>
		<category><![CDATA[ArcPy]]></category>
		<category><![CDATA[Petra]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[well bore paths]]></category>

		<guid isPermaLink="false">http://mygisblog.wordpress.com/?p=664</guid>
		<description><![CDATA[I recently had to bring in some IHS well data from Petra (or IHS Enerdeq) into ArcMap. While I endured 2 days of Introduction to Petra for Geoscientists this summer, I easy and expertise when it comes to using Petra &#8230; <a href="http://mygisblog.wordpress.com/2011/09/22/getting-petra-well-bore-paths-into-arcmap-using-python/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mygisblog.wordpress.com&amp;blog=3561924&amp;post=664&amp;subd=mygisblog&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I recently had to bring in some IHS well data from Petra (or IHS Enerdeq) into ArcMap. While I endured 2 days of Introduction to Petra for Geoscientists this summer, I easy and expertise when it comes to using Petra is rather limited. I agree with many online posters who complain about how clumsy, cluttered, and counter-intuitive PETRA is. But that&#8217;s another story. I was told by a well seasoned PETRA user that PETRA does not export to SHP file format, upon which she exported a well data table with lat/long&#8217;s for me as XLS. Whether the SHP limitation is indeed the case, I have not further investigated. I simply created an ESRI feature class from the LL data. Another needed step was exporting the well bore paths for directional wells into a polyline feature class for use in ArcMap. Again, the only way to get the data out of PETRA appeared to be as a table. I chose CSV.</p>
<p>The table has the following headers:</p>
<p>UWI | NAME | MD | TVD | EWOFFSET | NSOFFSET | DIP | AZM | TVDSS | XPATH | YPATH | SURNAME | SURSTAT</p>
<p>and provides a row of data for each survey depth, with UWI(API) repeating for all rows belonging to the same well.</p>
<p>To read this into Python, I did this:</p>
<p><pre class="brush: python;">
import csv

### Reference to Input CSV File
infile  = open('c:/temp/dirEXPORT.csv', &quot;rb&quot;)
reader = csv.reader(infile)

rownum = 0
well = &quot;&quot;
Wells = []
points = []

### Read CSV File, Line by Line
for row in reader:

    if rownum == 0: # First line in file: read headers
        colcount = 0
        for column in row:
            print column,
            if column == &quot;UWI&quot;:
                uwi = colcount
            if column == &quot;XPATH&quot;:
                xpath = colcount
            if column == &quot;YPATH&quot;:
                ypath = colcount
            if column == &quot;MD&quot;:
                z = colcount
            colcount = colcount + 1
            rownum=+1

    else:

        print &quot;\n&quot;

        ### Check if row (line) is for the same well as row above
        ### if so, read coordinates from field and assign to xyz as list
        if row[uwi] == well:
            xyz = [row[xpath],row[ypath],row[z]]
            points.append(xyz)
            print row[uwi], xyz
            rownum=+1

        ### If row does not belong to the same well as the the last row,
### then append coordinate list and well name to Wells list, reset
### coordinates list (=[]), and assign the coordinates to the new well
        else:
            Wells.append([well,points])
            print &quot;New Well&quot;
            points = []
            well = row[uwi]
            xyz = [row[xpath],row[ypath],row[z]]
            points.append(xyz)
            print row[uwi], xyz
            rownum=+1
infile.close
</pre></p>
<p>Any remaining print statements allow me to watch what&#8217;s going on when the program is run. It&#8217;s my crude way of debugging code.<br />
Once all the data is loaded into a list, I start some arcpy magic:</p>
<p><pre class="brush: python;">
import arcpy
from arcpy import env
import os

env.overwriteOutput = True
env.workspace = &quot;C:/temp&quot;

cnt = 0

mypath = env.workspace
outputFile = r&quot;wormtracks.shp&quot;
template = r&quot;c:\temp\template.shp&quot;
fieldLength = 25

sr = arcpy.Describe(template).spatialReference

arcpy.CreateFeatureclass_management(mypath,outputFile,&quot;POLYLINE&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,sr)
arcpy.AddField_management(outputFile, 'API', &quot;TEXT&quot;, &quot;&quot;, &quot;&quot;, fieldLength) # add API as new table field

rows = arcpy.InsertCursor(outputFile)
array_container = arcpy.Array()

for well in Wells[1:]: # Ignore first item in Wells list. Poor programming where an empty list is created.
    well_api = well[0] # First item in list is the API

    wellList = well[1] # 2nd item in list is a list of XYZ points

    for pt in wellList:
        point_object = arcpy.Point()
        point_object.X = float(pt[0])
        point_object.Y = float(pt[1])

        print pt[0]
        print pt[1]
        array_container.append(point_object) # I couldn't figure out the difference between array.append and array.add
        print point_object
        del point_object

    row = rows.newRow()
    row.shape = arcpy.Polyline(array_container) # Do not use arcpy.Multipoint which created a really messy polyline w/points ouf of sequence.
    row.API = well_api
    rows.insertRow(row)
    array_container.removeAll()

del row #unlock row
del rows #unlock table

del arcpy
del outputFile
</pre></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mygisblog.wordpress.com/664/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mygisblog.wordpress.com/664/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mygisblog.wordpress.com/664/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mygisblog.wordpress.com/664/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mygisblog.wordpress.com/664/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mygisblog.wordpress.com/664/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mygisblog.wordpress.com/664/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mygisblog.wordpress.com/664/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mygisblog.wordpress.com/664/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mygisblog.wordpress.com/664/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mygisblog.wordpress.com/664/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mygisblog.wordpress.com/664/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mygisblog.wordpress.com/664/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mygisblog.wordpress.com/664/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mygisblog.wordpress.com&amp;blog=3561924&amp;post=664&amp;subd=mygisblog&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mygisblog.wordpress.com/2011/09/22/getting-petra-well-bore-paths-into-arcmap-using-python/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/75b76f2b585ad16a98fe1ae050a820be?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Arne</media:title>
		</media:content>
	</item>
		<item>
		<title>ESRI/arcpy &#8211; Locked Files</title>
		<link>http://mygisblog.wordpress.com/2011/09/08/esriarcpy-locked-files/</link>
		<comments>http://mygisblog.wordpress.com/2011/09/08/esriarcpy-locked-files/#comments</comments>
		<pubDate>Thu, 08 Sep 2011 22:35:23 +0000</pubDate>
		<dc:creator>Arne</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[arcpy.env.overwriteOutput]]></category>
		<category><![CDATA[cursors]]></category>
		<category><![CDATA[garbage collection]]></category>
		<category><![CDATA[gc]]></category>
		<category><![CDATA[LOCK]]></category>
		<category><![CDATA[locked files]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://mygisblog.wordpress.com/?p=659</guid>
		<description><![CDATA[When working with geoprocessing tools in ArcGIS, especially using arcpy, you quickly learn about locked files. These files are locked because they are currently being edited, or being viewed in ArcCatalog, or otherwise accessed with ESRI products. This creates a &#8230; <a href="http://mygisblog.wordpress.com/2011/09/08/esriarcpy-locked-files/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mygisblog.wordpress.com&amp;blog=3561924&amp;post=659&amp;subd=mygisblog&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>When working with geoprocessing tools in ArcGIS, especially using arcpy, you quickly learn about locked files. These files are locked because they are currently being edited, or being viewed in ArcCatalog, or otherwise accessed with ESRI products. This creates a LOCK files that is displayed in e.g. Windows Explorer. Typically, upon successful completion of your geoprocessing task, the lock is removed (the LOCk files disappears). Unfortunately, when you run arcpy scripts outside of ArcMap&#8217;s Python window, oftentimes this doesn&#8217;t work, especially with cursors. I have found that I was getting errors like:</p>
<p><span style="color:#ff0000;">ExecuteError: ERROR 000258: Output C:/temp/myfile.shp already exists</span><br />
<span style="color:#ff0000;">Failed to execute (CreateFeatureclass</span></p>
<p>That despite the fact that I had set</p>
<p><pre class="brush: python; gutter: false;">arcpy.env.overwriteOutput = True</pre></p>
<p>(see me last post). So it&#8217;s a good habit to delete any references to cursors, e.g.:</p>
<p><pre class="brush: python; gutter: false;">

del row #unlock row
del rows #unlock table
del arcpy

</pre><br />
A couple of links with similar explanations are here: from <a href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//002z0000001q000000">ESRI</a> (scroll down on page), and from <a href="https://www.e-education.psu.edu/geog485/node/136">Penn State GIS</a>. Also very useful is Python garbage collection module to force deleting any references to strange objects or files you may be missing. Very simply:<br />
<pre class="brush: python; gutter: false;">

import gc
gc.collect()
</pre><br />
This has been may weapon of last resort. More about the module at <a href="http://docs.python.org/library/gc.html">Python Central</a>.</pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mygisblog.wordpress.com/659/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mygisblog.wordpress.com/659/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mygisblog.wordpress.com/659/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mygisblog.wordpress.com/659/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mygisblog.wordpress.com/659/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mygisblog.wordpress.com/659/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mygisblog.wordpress.com/659/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mygisblog.wordpress.com/659/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mygisblog.wordpress.com/659/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mygisblog.wordpress.com/659/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mygisblog.wordpress.com/659/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mygisblog.wordpress.com/659/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mygisblog.wordpress.com/659/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mygisblog.wordpress.com/659/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mygisblog.wordpress.com&amp;blog=3561924&amp;post=659&amp;subd=mygisblog&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mygisblog.wordpress.com/2011/09/08/esriarcpy-locked-files/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/75b76f2b585ad16a98fe1ae050a820be?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Arne</media:title>
		</media:content>
	</item>
		<item>
		<title>ESRI/arcpy frustrations [Python Case Sensitivity]</title>
		<link>http://mygisblog.wordpress.com/2011/09/08/esriarcpy-frustrations-python-case-sensitivity/</link>
		<comments>http://mygisblog.wordpress.com/2011/09/08/esriarcpy-frustrations-python-case-sensitivity/#comments</comments>
		<pubDate>Thu, 08 Sep 2011 18:06:05 +0000</pubDate>
		<dc:creator>Arne</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[ArcPy]]></category>
		<category><![CDATA[camelcase]]></category>
		<category><![CDATA[capitalize]]></category>
		<category><![CDATA[case sensitive]]></category>
		<category><![CDATA[ESRI]]></category>
		<category><![CDATA[problems]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://mygisblog.wordpress.com/?p=639</guid>
		<description><![CDATA[When I don&#8217;t use ESRI Python module for geoprocessing  &#8211; arcpy &#8211; every day, some of the idiosyncratic syntax of this (often not very Pythonic) module slips my mind. I was recently reminded of this when I ran into some &#8230; <a href="http://mygisblog.wordpress.com/2011/09/08/esriarcpy-frustrations-python-case-sensitivity/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mygisblog.wordpress.com&amp;blog=3561924&amp;post=639&amp;subd=mygisblog&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>When I don&#8217;t use ESRI Python module for geoprocessing  &#8211; <strong>arcpy</strong> &#8211; every day, some of the idiosyncratic syntax of this (often not very Pythonic) module slips my mind. I was recently reminded of this when I ran into some problems with very short scripts. Turns out that since Python is case sensitive, you&#8217;re best bet as to which words to capitalize or camelcase, isn&#8217;t always correct. More frustrating though is the fact</p>
<p><pre class="brush: python; gutter: false;">
&gt;&gt;&gt; import arcpy
&gt;&gt;&gt; sr = arcpy.Spatialreference()
</pre></p>
<p><span style="color:#ff0000;">Traceback (most recent call last):</span><br />
<span style="color:#ff0000;">File &#8220;&lt;pyshell#4&gt;&#8221;, line 1, in &lt;module&gt;</span><br />
<span style="color:#ff0000;">sr = arcpy.Spatialreference()</span><br />
<span style="color:#ff0000;">AttributeError: &#8216;module&#8217; object has no attribute &#8216;Spatialreference&#8217;</span><br />
<pre class="brush: python; gutter: false;">
&gt;&gt;&gt; sr = arcpy.SpatialReference()
&gt;&gt;&gt;
</pre><br />
So &#8216;Spatialreference throws an error but &#8216;SpatialReference&#8217; doesn&#8217;t. Remember to capitalize that &#8216;R&#8217;. &#8216;<a href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/SpatialReference/000v000000p6000000/">SpatialReferenc</a>e&#8217; is a class of the arcpy module, and classes, according to <a href="http://www.python.org/dev/peps/pep-0008/">PEP8</a>, should be named using the CapWord (or <a href="http://en.wikipedia.org/wiki/Camelcase">CamelCase</a>) spelling convention.<br />
So what about this &#8230;<br />
<pre class="brush: python; gutter: false;">

 &gt;&gt;&gt; fc = &quot;c:/temp/myfile.shp&quot;
 &gt;&gt;&gt; desc = arcpy.Describe(fc)
 &gt;&gt;&gt; print desc.spatialreference.name
 NAD_1927_StatePlane_Texas_South_Central_FIPS_4204
 &gt;&gt;&gt;
</pre><br />
Apparently, here I don&#8217;t have to capitalize anything. &#8216;spatialreference&#8217; works as the name of the property of dataset fc. But guess what ? So do:<br />
<pre class="brush: python; gutter: false;">

&gt;&gt;&gt; print desc.spatialreference.name
NAD_1927_StatePlane_Texas_South_Central_FIPS_4204
&gt;&gt;&gt; print desc.SpatialReference.name
NAD_1927_StatePlane_Texas_South_Central_FIPS_4204
&gt;&gt;&gt; print desc.SpatialReference.name
NAD_1927_StatePlane_Texas_South_Central_FIPS_4204
</pre><br />
Well, that seems very inconsistent. Another one (taken from that tripped me up was:<br />
<pre class="brush: python; gutter: false;">
fc = &quot;c:/temp/dirSurvey.shp&quot;
desc = arcpy.Describe(fc)
sr = desc.spatialReference
arcpy.CreateFeatureClass_management(&quot;C:/temp/&quot;,&quot;newFC&quot;,&quot;POLYLINE&quot;, &quot;&quot;, &quot;&quot;, &quot;&quot;, sr)
</pre><br />
<span style="color:#ff0000;">Traceback (most recent call last):</span><br />
<span style="color:#ff0000;">  File &#8220;&lt;pyshell#14&gt;&#8221;, line 1, in &lt;module&gt;</span><br />
<span style="color:#ff0000;">    arcpy.CreateFeatureClass_management(&#8220;C:/temp/&#8221;,&#8221;newFC&#8221;,&#8221;POLYLINE&#8221;, &#8220;&#8221;, &#8220;&#8221;, &#8220;&#8221;, sr)</span><br />
<span style="color:#ff0000;">AttributeError: &#8216;module&#8217; object has no attribute &#8216;CreateFeatureClass_management&#8217;</span><br />
<span style="color:#000000;">Apparently, this either used to be the correct name or some of the ESRI online documentation is wrong. But the method really is:</span><br />
<pre class="brush: python; gutter: false;">
arcpy.CreateFeatureclass_management(&quot;C:/temp/&quot;,&quot;newFC&quot;,&quot;POLYLINE&quot;, &quot;&quot;, &quot;&quot;, &quot;&quot;, sr)
</pre><br />
Another one I keep getting wrong because I forget to capitalize is:<br />
<pre class="brush: python; gutter: false;">
from arcpy import env
env.overwriteOutput = True # instead of overwriteoutput which would be wrong
</pre><br />
To make a long story short, I&#8217;ve learned that when I can&#8217;t remember what the propert name is, I type:<br />
<pre class="brush: python; gutter: false;">
&gt;&gt;&gt; dir (arcpy) # or dir(arcpy.env)
</pre><br />
and that gives me all the correct names for attributes and methods of arcpy that I need.</pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mygisblog.wordpress.com/639/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mygisblog.wordpress.com/639/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mygisblog.wordpress.com/639/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mygisblog.wordpress.com/639/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mygisblog.wordpress.com/639/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mygisblog.wordpress.com/639/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mygisblog.wordpress.com/639/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mygisblog.wordpress.com/639/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mygisblog.wordpress.com/639/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mygisblog.wordpress.com/639/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mygisblog.wordpress.com/639/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mygisblog.wordpress.com/639/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mygisblog.wordpress.com/639/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mygisblog.wordpress.com/639/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mygisblog.wordpress.com&amp;blog=3561924&amp;post=639&amp;subd=mygisblog&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mygisblog.wordpress.com/2011/09/08/esriarcpy-frustrations-python-case-sensitivity/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/75b76f2b585ad16a98fe1ae050a820be?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Arne</media:title>
		</media:content>
	</item>
		<item>
		<title>Merging PDF Files with Python</title>
		<link>http://mygisblog.wordpress.com/2011/08/26/merging-pdf-files-with-python/</link>
		<comments>http://mygisblog.wordpress.com/2011/08/26/merging-pdf-files-with-python/#comments</comments>
		<pubDate>Fri, 26 Aug 2011 21:55:02 +0000</pubDate>
		<dc:creator>Arne</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Merge]]></category>
		<category><![CDATA[pdf]]></category>
		<category><![CDATA[pyPdf]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://mygisblog.wordpress.com/?p=632</guid>
		<description><![CDATA[I think of at least one good topic a day for a blog post but I never seem to get around to documenting them. So here is a recent discovery in Python &#38; PDF. I was tasked with going through &#8230; <a href="http://mygisblog.wordpress.com/2011/08/26/merging-pdf-files-with-python/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mygisblog.wordpress.com&amp;blog=3561924&amp;post=632&amp;subd=mygisblog&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I think of at least one good topic a day for a blog post but I never seem to get around to documenting them. So here is a recent discovery in Python &amp; PDF.</p>
<p>I was tasked with going through a directory tree (sound familiar ? I have been do this sort of thing a lot lately), finding all PDF files and merging them into one large PDF file. The first thought was: what kind of Adobe product do we need for that. Then, I said: let me try that in Python. That in fact, turned out to be very straightforward. Simply download pyPdf, and take a look at the example there. No needc for Adobe.</p>
<p><pre class="brush: python;">

import pyPdf
import os

startDir = &quot;c:/temp&quot;
os.chdir(startDir)

fileList = os.listdir(startDir)
output = pyPdf.PdfFileWriter()

for item in fileList:
if os.path.splitext(item)[1].upper() == &quot;.PDF&quot;:
pdfDocument = os.path.join(startDir,item)
input1 = pyPdf.PdfFileReader(file(pdfDocument, &quot;rb&quot;))
for page in range(input1.getNumPages()):
output.addPage(input1.getPage(page))

outputStream = file(&quot;MyNewOutput.pdf&quot;, &quot;wb&quot;)
output.write(outputStream)
outputStream.close()

</pre></p>
<p>Just replace &#8220;c:\temp&#8221; with the directory you want to pull the PDF from and you&#8217;re in business. If I combine this with the recent script I wrote to explore directory structure, you can drill down through the directory tree searching for and merging PDF files.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mygisblog.wordpress.com/632/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mygisblog.wordpress.com/632/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mygisblog.wordpress.com/632/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mygisblog.wordpress.com/632/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mygisblog.wordpress.com/632/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mygisblog.wordpress.com/632/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mygisblog.wordpress.com/632/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mygisblog.wordpress.com/632/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mygisblog.wordpress.com/632/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mygisblog.wordpress.com/632/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mygisblog.wordpress.com/632/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mygisblog.wordpress.com/632/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mygisblog.wordpress.com/632/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mygisblog.wordpress.com/632/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mygisblog.wordpress.com&amp;blog=3561924&amp;post=632&amp;subd=mygisblog&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mygisblog.wordpress.com/2011/08/26/merging-pdf-files-with-python/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/75b76f2b585ad16a98fe1ae050a820be?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Arne</media:title>
		</media:content>
	</item>
		<item>
		<title>ESRI UC 2011 &#8211; First Time Attending</title>
		<link>http://mygisblog.wordpress.com/2011/08/10/esri-uc-2011-first-time-attending/</link>
		<comments>http://mygisblog.wordpress.com/2011/08/10/esri-uc-2011-first-time-attending/#comments</comments>
		<pubDate>Wed, 10 Aug 2011 20:17:52 +0000</pubDate>
		<dc:creator>Arne</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[ESRI UC 2011 experience]]></category>

		<guid isPermaLink="false">http://mygisblog.wordpress.com/?p=627</guid>
		<description><![CDATA[This was the first year that I made it out to the ESRI User Conference in San Diego. As expected, the sheer size of the event was a little overwhelming. While I had spent some time looking over the agenda &#8230; <a href="http://mygisblog.wordpress.com/2011/08/10/esri-uc-2011-first-time-attending/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mygisblog.wordpress.com&amp;blog=3561924&amp;post=627&amp;subd=mygisblog&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://mygisblog.files.wordpress.com/2011/08/esri.jpg"><img class="alignleft size-full wp-image-628" style="margin:10px;" title="esri" src="http://mygisblog.files.wordpress.com/2011/08/esri.jpg?w=500" alt=""   /></a>This was the first year that I made it out to the ESRI User Conference in San Diego. As expected, the sheer size of the event was a little overwhelming. While I had spent some time looking over the agenda to see what I might be interested in, once inside the Convention Center, it felt like I was spending more time running from session to session than actually sitting still. There is definitely a lot of resources to be found at the UC but you have got to pick out the goodies. I thought some of the most useful material came from the &#8220;tips and tricks&#8221; types technical sessions while the audience size for something like &#8220;How to implement Enterprise Solution &#8230;&#8221; made for a less fruitful learning experience. Most of all, I enjoyed meeting a bunch of fellow GIS folks, e.g. at the the PUG Social. Looking forward to 2012 !</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mygisblog.wordpress.com/627/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mygisblog.wordpress.com/627/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mygisblog.wordpress.com/627/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mygisblog.wordpress.com/627/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mygisblog.wordpress.com/627/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mygisblog.wordpress.com/627/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mygisblog.wordpress.com/627/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mygisblog.wordpress.com/627/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mygisblog.wordpress.com/627/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mygisblog.wordpress.com/627/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mygisblog.wordpress.com/627/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mygisblog.wordpress.com/627/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mygisblog.wordpress.com/627/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mygisblog.wordpress.com/627/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mygisblog.wordpress.com&amp;blog=3561924&amp;post=627&amp;subd=mygisblog&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mygisblog.wordpress.com/2011/08/10/esri-uc-2011-first-time-attending/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/75b76f2b585ad16a98fe1ae050a820be?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Arne</media:title>
		</media:content>

		<media:content url="http://mygisblog.files.wordpress.com/2011/08/esri.jpg" medium="image">
			<media:title type="html">esri</media:title>
		</media:content>
	</item>
		<item>
		<title>Exploring Directory Structure [PYTHON]</title>
		<link>http://mygisblog.wordpress.com/2011/08/09/exploring-directory-structure-python/</link>
		<comments>http://mygisblog.wordpress.com/2011/08/09/exploring-directory-structure-python/#comments</comments>
		<pubDate>Tue, 09 Aug 2011 13:25:53 +0000</pubDate>
		<dc:creator>Arne</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[count files]]></category>
		<category><![CDATA[Directory tree]]></category>
		<category><![CDATA[file types]]></category>
		<category><![CDATA[output text file]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://mygisblog.wordpress.com/?p=609</guid>
		<description><![CDATA[So,here is a recent Python script I cobbled together. If you&#8217;re more of a programmer than myself, you will probably scream at some of my syntax. Do I really need all the &#8216;globals&#8217; ? I have a sense there a more &#8230; <a href="http://mygisblog.wordpress.com/2011/08/09/exploring-directory-structure-python/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mygisblog.wordpress.com&amp;blog=3561924&amp;post=609&amp;subd=mygisblog&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>So,here is a recent Python script I cobbled together. If you&#8217;re more of a programmer than myself, you will probably scream at some of my syntax. Do I really need all the &#8216;globals&#8217; ? I have a sense there a more Pythonic (succinct) ways of accomplishing the same result. But this worked.</p>
<p>The idea was to type in a starting directory and a name for a text file, after which the script recursively drills down through the directory tree, printing file names, examining file extensions, counting files and file size, and then spits out totals, plus &#8211; for a visual aid -  prints a quick and dirty histogram. So let me know what to improve next time around.</p>
<p><pre class="brush: python;">

from __future__ import division

### Cobbled Together by Arne, July 2011
### using the MyOutput() bits by xiao, from
### http://tech.xster.net/tips/python-log-stdout-to-file/

import os, sys

class printToFile():
''' directs print output (stdout) to textfile'''
def __init__(self, logfile):
self.stdout = sys.stdout
self.log = open(logfile, 'w')

def write(self, text):
self.stdout.write(text)
self.log.write(text)
self.log.flush()

def close(self):
self.stdout.close()
self.log.close()

def dictHistogram(extCount):
''' Creates simple histogram based on key-value entries in
file extension/frequency dictionary (extCount) '''
vcount = 0
kcount = 0
for k,v in extCount.iteritems():
vcount = vcount + v

for k,v in extCount.iteritems():
#print v
share = round((v/vcount) * 100,2)
print v, &quot;\t&quot;, &quot;File Type &quot;, k, &quot;\t&quot;, int(share)*&quot;#&quot;, share, &quot;% of total&quot;

def displayFileInfo(entryPath):
'''Displays file name, size when exploreSub() encounters an entry
that is not a directory. New extensions are added to the extensions
list, files are counted in totalFiles, and file size is added up
in totalSize'''
global extensions
global totalSize
global fileCount
global totalFiles
global extCount

print &quot;\t&quot;,os.path.basename(entryPath)
ext = os.path.splitext(entryPath)[1].upper()

totalSize = totalSize + os.path.getsize(entryPath)

if ext not in extensions:
extensions.append(ext)
extCount[ext] = 1

else:
a = extCount[ext]
a = a + 1
extCount[ext] = a

def exploreSub(dirEx):
''' Drills down into a file tree, starting with dirEx. If an empty
directory is encountered, function breaks from loop, if a file is
encountered, the file's path is added to a list of files to examined
later, and if a non-empty directory is encountered, exploreSub is
recursively drills down to the next level. Once all directories have
been explored, the files in the list are examined one at a time.'''

global files
global fileCount
print
print dirEx

if os.listdir(dirEx) == []:

print &quot;Is an empty directory.&quot;
print

else:
for entry in os.listdir(dirEx):
entryPath = os.path.join(dirEx,entry)
if os.path.isdir(entryPath):
print &quot;\t&quot;, entry, &quot;&lt;Dir&gt;&quot;
else:
displayFileInfo(entryPath)

for entry in os.listdir(dirEx):
entryPath = os.path.join(dirEx,entry)
if os.path.isdir(entryPath):
try:
exploreSub(entryPath)
except:
Print &quot;Unable to open &quot;, entryPath

extensions = []
files = []
extCount = {}
fileCount = 0
totalFiles = 0
totalSize = 0

start = raw_input(&quot;Enter Directory: &quot;)
log = raw_input(&quot;Enter Name for Logfile: &quot;)

sys.stdout = printToFile(log)
exploreSub(start)

print
print &quot;Total Number of Files &quot;, totalFiles
print &quot;Total File Volume &quot;, round(totalSize/1048576), &quot; MB&quot;
print &quot;File Types Encountered: &quot;
print extensions
print

dictHistogram(extCount)

</pre></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mygisblog.wordpress.com/609/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mygisblog.wordpress.com/609/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mygisblog.wordpress.com/609/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mygisblog.wordpress.com/609/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mygisblog.wordpress.com/609/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mygisblog.wordpress.com/609/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mygisblog.wordpress.com/609/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mygisblog.wordpress.com/609/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mygisblog.wordpress.com/609/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mygisblog.wordpress.com/609/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mygisblog.wordpress.com/609/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mygisblog.wordpress.com/609/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mygisblog.wordpress.com/609/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mygisblog.wordpress.com/609/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mygisblog.wordpress.com&amp;blog=3561924&amp;post=609&amp;subd=mygisblog&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mygisblog.wordpress.com/2011/08/09/exploring-directory-structure-python/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/75b76f2b585ad16a98fe1ae050a820be?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Arne</media:title>
		</media:content>
	</item>
		<item>
		<title>First 2 Months as GIS Analyst&#8230;</title>
		<link>http://mygisblog.wordpress.com/2011/08/08/first-2-months-as-gis-analyst/</link>
		<comments>http://mygisblog.wordpress.com/2011/08/08/first-2-months-as-gis-analyst/#comments</comments>
		<pubDate>Mon, 08 Aug 2011 17:24:15 +0000</pubDate>
		<dc:creator>Arne</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[GIS]]></category>
		<category><![CDATA[new job]]></category>
		<category><![CDATA[oil gas]]></category>

		<guid isPermaLink="false">https://mygisblog.wordpress.com/2011/08/08/first-2-months-as-gis-analyst/</guid>
		<description><![CDATA[As mentioned back in June, I started a new job as GIS Analyst for an oil &#38; gas (E/P) company, and I’ve been having a blast. After straddling the worlds of GIS and engineering geology for a few years, I’m &#8230; <a href="http://mygisblog.wordpress.com/2011/08/08/first-2-months-as-gis-analyst/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mygisblog.wordpress.com&amp;blog=3561924&amp;post=605&amp;subd=mygisblog&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>As mentioned back in June, I started a new job as GIS Analyst for an oil &amp; gas (E/P) company, and I’ve been having a blast. After straddling the worlds of GIS and engineering geology for a few years, I’m glad to finally get to focus on GIS. And there is no lack of challenges in the new job. The learning curve has been a joy!</p>
<p>The GIS department I’m part of has been tasked to build an enterprise GIS using ArcGISServer, ArcSDE, SQLServer 2008, and MS Silverlight. Moreover, we are working on a Master Data Management Solution that will allow data from multiple departments to be available through the Silverlight powered web app.</p>
<p>For me, the challenge, therefore, has been and continues to be two fold:</p>
<p><strong>1) Brush up on many aspects of ESRI technology:</strong></p>
<p><em>ArcGIS Server, ArcSDE, Python. Silverlight</em>…</p>
<p><strong>2) Learn about a whole range of oil/gas industry software applications:</strong></p>
<p><em><a href="http://www.ihs.com/products/oil-gas-information/analysis-software/petra.aspx">IHS Petra</a>, <a href="http://www.seismicmicro.com/">SMT Kingdom</a>, <a href="http://www.neuralog.com/pages/NeuraSection.html">NeuraSection</a>, <a href="http://www.landworks.com/">Landworks</a>, <a href="http://www.merricksystems.com/oil-and-gas-software/engineering-workspace/rio.html">Merrick/RIO</a></em>, the list continues</p>
<p>and how they might become part of the MDMS using <em><a href="http://www.neuralog.com/pages/NeuraDB.html">NeuraDB</a>, <a href="http://www.volantsolutions.com/ECadapters.htm">Volant</a>, <a href="http://www.safe.com/fme/fme-technology/">FME</a></em>…</p>
<p>I guess you could say we got our work cut out for us.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mygisblog.wordpress.com/605/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mygisblog.wordpress.com/605/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mygisblog.wordpress.com/605/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mygisblog.wordpress.com/605/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mygisblog.wordpress.com/605/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mygisblog.wordpress.com/605/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mygisblog.wordpress.com/605/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mygisblog.wordpress.com/605/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mygisblog.wordpress.com/605/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mygisblog.wordpress.com/605/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mygisblog.wordpress.com/605/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mygisblog.wordpress.com/605/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mygisblog.wordpress.com/605/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mygisblog.wordpress.com/605/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mygisblog.wordpress.com&amp;blog=3561924&amp;post=605&amp;subd=mygisblog&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mygisblog.wordpress.com/2011/08/08/first-2-months-as-gis-analyst/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/75b76f2b585ad16a98fe1ae050a820be?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Arne</media:title>
		</media:content>
	</item>
	</channel>
</rss>
