Monday, January 23, 2012

ArcGIS 10.0 Service Pack 4 Announcement

Check it out here.

Enjoy

Wednesday, January 18, 2012

STOP SOPA AND PIPA

If you haven't been living under a rock, you should know what SOPA and PIPA are, if you were check out https://www.google.com/landing/takeaction/sopa-pipa/

I encourage everyone to tell congress to stop it.

Tuesday, January 10, 2012

Tip - Faster Update Cursors

There are many ways to limit the number of fields an update cursor can update.  The cursor object itself has a where clause option.  Another way, which seems at first glance to be faster than just a where clause on the cursor, is to use a Layer object with a definition query defined on the Layer object, then reference the object instead of the feature class or feature layer itself.

import arcpy
from arcpy import mapping
fclayer = "fclayer"
arcpy.MakeFeatureLayer_management(source, fclayer)
layer = mapping.Layer(fclayer)
layer.definitionQuery = "UIDField = 'unique'"
uRows = arcpy.UpdateCursor(layer)
row = None
for row in uRows:
    row.URL = url
    uRows.updateRow(row)
del row
del uRows
del layer
del fclayer

For more information check out the help page here.

Enjoy

Tuesday, January 3, 2012

I heart my Nook Color and Nook Tablet

For over a year now, I have had the Nook Color, and I am very pleased with the e-reader, so this year I upped the game and bought the tablet version of Nook.  The OS and feel is exactly the same except the hardware inside is vastly improved.  It's quicker and more responsive than the Nook Color and can do more with the applications that can be put on it.  The biggest improvement I see with the tablet version of the Nook is the anti-glare screen.  I know this can be achieved by buying an anti-glare screen guard, but who wants that on the Nook.  I sure don't.

Anyway this wasn't for me, it was for my wife and she loves it.  All the Nook needs is a better selection of apps.  As an e-reader, this is number 1, and Barnes and Noble seems to have more and more e-books daily.

In addition to using the bn website to buy books, you can go to site like ManyBooks, or if you are a sci-fi junkie try the Baen free library.  The thing I really like about my Nook, is that I can use it at my local library as well!  I can just check out my e-book from anywhere as long as I have my library card.

The issue I really do not like about any tablet/reader is the virtual keyboard, but that's even an issue for the sacred iPad.

Monday, December 19, 2011

Exit that Script, and exit it now!

Help, I need to kill my script!  Use the sys.exit() gives me an error!!  What to do?

Use the try/except method to just move beyond those errors my friend.  Very simple.


import arcpy
from arcpy import env
import sys
value = arcpy.GetParameterAsText(0)
try:
    arcpy.AddMessage(value)
    arcpy.AddMessage("VERY INTERESTING VALUE....")
    arcpy.AddMessage("FORCED EXIT")
    sys.exit(0)
except SystemExit:
    arcpy.AddMessage("WHEN I EXIT I GO HERE: SystemExit exception")
    pass
except:
    arcpy.AddError("ERROR ERROR" )
    arcpy.AddError(arcpy.GetMessages(2))


Enjoy!

*You can also use:
import os
os_exit(0)
I haven't tested this though.

Saturday, December 17, 2011

Displaying Messages for a Specific Tool

Robust messaging is very important to help developers debug issues and it helps end users understand what the tool is doing.

ArcGIS Desktop geoprocessing tools have robust messaging built in, but when you run a script, those messages get lost.  To access individual tool messages, just do the following:



import arcpy
from arcpy import env
import sys
env.overwriteOutput = True
sr = arcpy.SpatialReference()
sr.factoryCode = 4326
sr.create()
pt = arcpy.Point(-78,38)
pointGeom = arcpy.PointGeometry(pt,sr)
copiedPt = arcpy.CopyFeatures_management(pointGeom)
print copiedPt.getMessages()


This produces:


Executing: CopyFeatures in_memory\f331817DB_DC61_4523_88F8_1B0329E5F568 c:\TEMP\copiedPT.shp # 0 0 0
Start Time: Fri Dec 16 13:10:14 2011
Succeeded at Fri Dec 16 13:10:14 2011 (Elapsed Time: 0.00 seconds


Very cool and enjoy

Friday, December 16, 2011

Support HTML Tages in Page Layout

Please support the idea of allowing HTML tags in labels:

http://ideas.arcgis.com/ideaView?id=08730000000bsT8AAI

Thanks