jbaltierra

Select and Zoom Script

Discussion created by jbaltierra on Mar 1, 2013
Latest reply on Mar 4, 2013 by jbarrette-esristaff
Hi All, I am attempting to make a simple select and zoom python script for my address points. Currently the script will complete successfully but will not select or zoom to the entered point. I am using two parameters that have been set in the Script Tool. Address_Number (Long) and Address_Name (String) which both have identical spellings/data types in Properties>>Parameters

Here's the code:
import arcpy
mxd = arcpy.mapping.MapDocument("CURRENT")
df = arcpy.mapping.ListDataFrames(mxd, "*")[0]
addLayer = arcpy.mapping.Layer("G:\Layers\GIS_SDE.AddressPoints.lyr")
arcpy.mapping.AddLayer(df, addLayer, "TOP")
Address_Number = arcpy.GetParameterAsText(0)
Address_Name = arcpy.GetParameterAsText(1
arcpy.SelectLayerByAttribute_management("GIS_SDE.AddressPoints", "NEW_SELECTION", "A_NBR = %Address_Number% AND ADDR = %Address_Name%")
df.zoomToSelectedFeatures() 


Any help is appreciated.

Thanks,
Jordan

Outcomes