POST
|
Hello, I'm trying to develop a quick tool to perform a definition query on a group layer based on the users input (Field, Value in Field, and Group Layer). I did some searching around and came up with the script that I have below. Originally I set the field, value, and group parameters directly equal to a particular value and the code worked perfectly. But now I want the user to be able to enter the field and value they want to perform the definition query with as well as which group layer to use. Every time I run the tool it says that "field" is undefined which means some how my parameters are not being returned. Is there some syntax that I'm missing or do I have any of the parameters set up incorrectly. I'm just starting to learn python so any help is welcome. Thanks. import arcpy #Variables to form defintion query def getParameterInfo(self): field = arcpy.Parameter( displayName="Field", name="field", datatype="Any Value", parameterType="Required", direction="Input") value = arcpy.Parameter( displayName="Value in Field", name="value", datatype="Any Value", parameterType="Required", direction="Input") group = arcpy.Parameter( displayName="Group Layer Name", name="group", datatype="Group Layer", parameterType="Required", direction="Input") params = [field, value, group] return params #concatenate query syntax queryStr = str(field) + "=" + str(value) #Specify the MXD project (CURRENT), dataframe (Layers) mxd = arcpy.mapping.MapDocument("CURRENT") df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0] #Apply defintion query to specified layer group (Test) for lyr in arcpy.mapping.ListLayers(mxd, group, df)[0]: if lyr.supports("DEFINITIONQUERY"): lyr.definitionQuery = queryStr arcpy.RefreshActiveView()
... View more
09-15-2014
07:40 AM
|
0
|
3
|
3247
|
POST
|
Hello, My company uses Citrix to access all ArcGIS components (Catalog, ArcInfo, ArcScene, etc..) so we do not have the software installed on our computers. I'm trying to work with pythonWin to edit scripts on my machine and then use those scripts through the Citrix applications. I currently have python/PythonWin and numpy installed on my machine but is it possible to get arcpy installed without having ArcGIS Desktop installed as well? Thanks, Jason
... View more
06-20-2014
05:55 AM
|
0
|
3
|
972
|
POST
|
Hello everyone, I am wondering if it is possible to force the output of a tool to use a specific color ramp using python code. I downloaded a tool that automatically creates filled contours from DEM's at intervals that I specify. The code is written to look for a symbology layer to use for the symbology of the output but I am looking for a way to set the symbology to a specific color ramp without using a symbology layer. I have been digging through the forums but have not come across anything that addresses my question directly. Thank you in advance for any information you have. Thanks, -Jason
... View more
04-03-2013
08:11 AM
|
0
|
0
|
673
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|