Web Analytics Made Easy -

Node Dangles


Recently I’ve created Python add-ins for data entry for our staff. Most of these have a toolbar with a ‘Help’ button that opens a help file in .pdf format.Sample python add-in toolbar. The first add-in was for ArcCatalog and this worked splendidly. I was using os.startfile(path to help.pdf). However, when I started doing ArcMap add-ins, clicking the Help button would open the help.pdf but ArcMap would crash. Oops! Luckily the Python development team at Esri already had a blog post about this at their ArcPy Café blog.
I’ve been working on a few different data import routines and one of the things I recently built was the ability to verify that a potential Code to be entered into a field with a Coded Value Domain is valid. The logic of the code is pretty straight-forward. Get a field’s domain and check that a potential value is one of the code values. The biggest ‘trick’ in this code is that arcpy.
I just had the need to go through a directory containing many (100+) layer files (.lyr) and verify the data sources in each. I could have loaded each into ArcMap and checked the properties, but choose not to. Here’s the bare-bones script I used instead: import arcpy, glob,os theDir = r"L:\gdrs\data\org\us_mn_state_dnr\elev_minnesota_lidar\\" os.chdir(theDir) for iFile in glob.glob("*.lyr"): print iFile lyr = arcpy.mapping.Layer(iFile) for i in arcpy.mapping.ListLayers(lyr): try: print " {0}: {1}".format(i,i.dataSource) except: print " {0}: Does not support dataSource".
I’ve been asked this twice this week, so thought I should post it. Calculating Null values in the ArcMap Field Calculator is easy, if you can remember the right work for ‘Null’. The proper word is ‘None’ (without the quotes). Good luck & have a good weekend.
I’m in the process of rewriting a process, moving most of the processing from arcpy to postgresql-enabled python (love me some psycopg2). One of the QC checks I’m doing at the end of this re-write is just verifying that the feature class schemas are the same (or that the differences are intended) under the new process as they were in the old process. And while ArcGIS does have a good tool for this, there were a couple tweaks I wanted to make.
I mentioned using Tapiriik to batch download my entire Garmin Connect history–over 1,000 separate .GPX files. I found several tools to convert .GPX to shapefiles that worked but none seemed to recognize my heart rate data. The trick is Garmin extends the GPX specification to incorporate the heart rate: <span style="color: #333333;">xmlns:gpxtpx="http://www.garmin.com/xmlschemas/TrackPointExtension/v1"</span> Each track point looks like this: 2014-03-16T20:35:47+00:00 296.20001220703125 86 gpxtpx:TrackPointExtension trkpt  Since the first few exiting GPX converters failed to meet my needs, I decided to make my own, at least partially.
Back in 2010, I posted a python script and an ArcToolbox tool for zipping a shapefile. Well, I had a request to modify the code so it would not error out if it encounters a .lock file. While .lock files exist for a reason and shouldn’t be totally ignored, in some cases it is safe to do so, so I went ahead any modified the code, which can be downloaded from Github.
This Friday Fave is more for utility than pleasure. Unfortunately, I have been working to determine why my views and query layers perform so much worse than directly accessing my feature class. My Googling led me to Geodatabase Geek, by Trevor Hart, Eagle Technology Group Ltd. Trevor has some real good information about Geodatabases and also gave a good lightening talk on Usage Reporting on ArcGIS 10.1 for Server at the 2013 ESRI International Developer’s Conference.
This Friday Fave is a little bit different. My interest in geospatial technologies (although we just called it GIS back then) largely because I wanted to measure my running routes more accurately and efficiently than the paper map & scrap of paper method I was using in the early 90s. When I was introduced to GIS, I knew what I was going to use it for. Now that GPS technology is ubiquitous–I’m currently using four different GPS devices, at the same time, on my bike rides–I seldom have to use a map to measure my routes.
In mapping cross sections, our geologists often find themselves renaming their stratigraphic units midway, or at the end, of creating multiple cross sections. This can cause a situation where we need to change multiple values in multiple fields in multiple feature classes–a situation that can get messy very fast. Perfect situation for a quick & dirty arcpy script and, in this case, an ArcToolbox tool that can be downloaded. This tool will change all feature classes in the O:\clay_cga\sand-distribution_model\dnrPackages\stratlines directory.