MakeFeatureLayer and SelectByLocation_management()

I need to always remember this when I see the error that says “The value cannot be a feature class”. The difference between a feature layer and a feature class seems sort of nebulous to me. As long as I remember to convert a feature class to a feature layer first before doing the selection, it will work fine. For example ...


gp.MakeFeatureLayer_management("some_fc", "some_fc_Make")
gp.SelectLayerByAttribute_management("some_fc_Make", "NEW_SELECTION", "GRIDCODE = 2")

Oh and this is necessary for Select By Attribute AND Select By Location.

This is also important when using CopyFeatures. The help says this about CopyFeatures.

execfile - saving me time

I'm continuing to test python scripts in version 10 with arcpy . When a long script encounters an error, I have been re-running it from the beginning. I came across the execfile command (knowing there must be a way to restart the script) and it has been very useful for me in picking up where I left off. I can look at the spot where things stop, and run this command in the Python Shell and I'm back in business.

The syntax is simply this … execfile(“path_and_filename.py”)

My First TUgis

I attended the TUgis Conference at Towson State University this past Tuesday March 19th. I have thought about attending for a number of years now. I guess the stars aligned with this being a less expensive 1-day event, me having extra time during the week, and just a really strong desire to see what all the other GIS Professionals are doing these days. I was really impressed with the conference.

All I want for Christmas is GIS

Just saw this blog post on GIS and Christmas. It has some cool stuff like a binary map of cities where people google santa vs. zombies and a map of probability of having a white Christmas. Pretty neat post from the folks at GIS Lounge.
http://gislounge.com/christmas-and-gis/

Downloading from the National Map

Here is a link for directions for downloading data from the National Map.
http://viewer.nationalmap.gov/help/9.0%20TNM%20Cart%20Tab.htm

I'm not used to this yet. I liked the old system with the handy dandy X/Y tool and entering the coordinates. When you go to the link above and scroll down to 9.6 it lists a method for using coordinates.

Use the following procedures to enter coordinate extents to create a custom reference area polygon to download data:

Enter a coordinate value into the Search box, such as 32.5, -98.25 in decimal degrees.
Zoom to the coordinate value.
Select Draw Annotation from the More menu in the Search Results.

Unable to Merge Rasters programmatically with ArcGIS 10

Ok to add to my disdain over the way the spatial analyst toolbar was stripped down ... I know cannot figure out how to do a simple merge (rasters) with spatial analyst and the Raster Calculator command (in the Map Algebra Toolbox). This is something I do all the time when using 9.3. I am re-writing a script and gave up on this so now I'm trying their recommended way of doing this. This recommendation is the "improved" (their words not mine) "Mosaic to New Raster" tool.

Now I'm getting a new error (000157: Input and target dataset should have the same number of bands). My problem with this error is that the input and target datasets do have the same number of bands. To explain this problem, I found this.

XTools Show Directions requirements

This took me some creative googling so I wanted to remember this. Show Directions in XTools requires (at least at 7.0) that data and data frame be in the same coordinate system. I kept wondering why I couldn't get the little red arrows to show up and now I know why.

http://forum.dataeast.com/viewtopic.php?f=22&t=390

How to get colors from a color map

I want to document this so I'll never forget it. This is my workaround for getting colors from a tiff file with a colormap. I'm working with NASS data and the tiff file has RGB values in the attribute table. Every time I try to apply the color settings to a grid I made (from this tiff !!!) using Import on the Symbology tab, it gives the message or error "Cannot apply settings from Colormap renderer to Unique Values renderer". Oye ! This was killing me. Searches on the ESRI forums gave me no help at all though I'm sure countless others have had this problem. I once created an entire lyr file color by color by jotting down all the RGB or HSV values (not sure which I used). But that was for a relatively small group of colors and values.

Anyway Here is what I did. This worked fine.

ArcGIS 10 Spatial Analyst - (growing pains)

I'm finally getting around to trying the new version(version 10) of the ArcGIS software. Perhaps my first few hours using it aren't enough time to properly evaluate the product. Perhaps I'll follow up with some words of praise. But that won't happen here today. My frustration centers around the Spatial Analyst extension.

First of all ... Why did they remove all the useful functionality of the Spatial Analyst Toolbar ? All the things that remain on the toolbar are all the things I ignored in version 9.x (and certainly will continue to ignore). Some blogs have stated that things like the spatial analyst options, conversion from and to raster/vector etc. were taken out because they were redundant with the tools in the toolbox. Is that a reason or an excuse ?

MakeTableView_management

I just posted a note to the ESRI Web Team that their documentation on the old 9.3 product (I'm still using 9.3.1) had an error. Lets see if they update it. I've been using MakeTableView_management in Python which is necessary for doing a join (long story; see below) and is also apparently handy for renaming fields which is another purpose that I have for the tool. The documentation in the software and online is incorrect with respect to the field_info argument. The script example says ...

gp.maketableview "nf_roads", "TCH", "[ROAD_CLASS] = 'TCH'", "LEVEL ROAD_CODE VISIBLE, NAME NAME HIDDEN"

Syndicate content