A feature class is a single geometry with an attribute table…period. True, it should also have a spatial reference, and likely needs one to function correctly. Still, in the simplest form, all you need is a single geometry (points, lines or polygons) and an associated attribute table.
It is no great secret I am an instructor for Esri. As a result, my perspective of GIS is highly Arc-Centric. It could even be said I view GIS using the Esri projection, but that might be a little too geeky even for me. I digress. Let’s get back on topic. Focus monkey…focus. Continue reading
A colleague today brought in a newspaper clipping from the weekend edition of the Wall Street Journal for 13-14 April, 2013. It was a map depicting the extimated range of North Korea’s Musudan missile. A couple of things were immediately interesting about this. First, the buffered area did not appear to actually be circular. Second, Alaska was tossed up in the upper right corner.
Working with GIS, I am well aware projections will make us all SADD. Projections distort shape, area, distance and direction. This map was interesting. At first, nothing really seemed right. Continue reading
Recently I have been working on creating a Python tool using regular expression matching. This most definitely is something I am not well versed in. It has been a steep learning curve. Along the way, I did discover a really useful tool for testing the regular expressions I was creating, the Python Regular Expression Testing Tool. It is little more than a place to enter the regular expression, some sample text, and see if it works.
Not too long ago Esri transitioned to delivering class completion certificates electronically. This makes it a little easier to avoid misplacing them, making copies and retrieving them if lost. Continue reading
Converting CAD files to feature classes in ArcGIS, either Shapefiles or Feature Classes in a geodatabase, can be a time consuming process. CAD files store data grouped according to geometry. Within each feature class, individual layers in the CAD drawing are identified using an attribute field. Typically it is desirable to have each layer in a new feature class in ArcGIS. Extracting each layer is a process of selecting and exporting in ArcMap. This can be a redundant and time consuming process… a process especially well suited for a script. Continue reading
Pulling into the driveway just before 10:00pm and walking into the house, I step over three pairs of shoes in the entry way and head up the stairs. Opening the fridge to get a beer, everything in the fridge is way more organized than either my wife or myself would ever keep it. Even the knives on the knife magnet on the wall are evenly spaced and organized in descending order. I do not have to look in the cabinets. I already know. All of the pots and pans are organized in descending order as well. Heading up the stairs to find something in my office, on the desk is a pair of huge Dr. Dre Beats headphones laid on top of the closed laptop. Continue reading
Yes, although this blog has primarially morphed in to a complete GIS geek’s blog, my personal computer is still a Mac. Work provides me with a good Windows computer. I have an older Windows 7 desktop at home with an ESXi server in the closet for testing out new stuff on virtual machines. In the interest of simplicity, when putting together Linux virtual machines, typically I use Turnkey Linux. I like Debian. It has most of the tools already installed I like and it updates itself daily. What is not to like? Continue reading
First and foremost, I have to concede, Packt Publishing recently provided a copy of Programming ArcGIS 10.1 with Python Cookbook to review. Packt provided a copy free of change in exchange for a review on my website. To their credit, there were no expectations or strings attached. I can say whatever I want about the book.
I wish the Programming ArcGIS 10.1 with Python Cookbook (Python Cookbook) had been around when I started attempting to flounder with Python a couple of years ago. The Python Cookbook presents Python scripting as a way for GIS jocks to get stuff done efficiently. The starting point for solutions is ArcGIS for Desktop, typically ArcMap. This makes the Python Cookbook a perfect starting point for a GIS jock who knows nothing about Python, but wants to be able to work smarter, and not harder. Continue reading
A while back I posted a slightly more verbose solution for this. Since then two things have changed. First, I have used Python a LOT more and understand how to use sets, lists and functions a little better. Second, the data access module has been added to ArcPy. The data access module cursors are much faster than the old cursors and also allow for field filtering, meaning Python does not have to load the entire table when searching. This updated version takes advantage of this. If you are using this functionality with large datasets, this updated version may be a little faster and save you some time processing.
# Return list all permutations of field in input feature class or table
def getValueList (inputTable, field):
valueSet = set() # set to hold unique values
# use data access search cursor combined with, 'with'
with arcpy.da.SearchCursor(inputTable, field) as values:
# iterate through all values returned by Search Cursor
for value in values:
# Add value to set. If the value is not present,
# it will be added. If it is present, the set will not
# allow duplicates.
# sort and return list of values
Creating toolsets within ArcGIS Python Toolboxes is surprisingly simple, but unfortunately somewhat difficult to locate in the documentation. Hopefully this will make it a little easier.
A tool’s membership in a toolset is determined by category property of the tool class. Implementing this looks like the following in code.
# ArcGIS tool properties
self.label = 'Create SDE Workspace'
self.canRunInBackground = False
self.category = 'Create'
The end result produces toolsets in the toolbox like the following in the SDE Workspace Creation Toolbox.