POST
|
Attached is a sample geodatabase containing one of 40+ feature datasets. As I mentioned previously, the tool runs successfully (no errors) in 2 seconds but no fields get updated with the user inputted values. Thanks again.
... View more
01-06-2015
11:13 AM
|
0
|
1
|
852
|
POST
|
It runs successfully but nothing gets updated. I'll send some sample data in a bit. Thanks for your help with this. Sent from my iPhone
... View more
01-06-2015
09:49 AM
|
0
|
0
|
852
|
POST
|
Thanks for the help. I am running 10.1 with SP1. Any help you could offer would be greatly appreciated.
... View more
01-05-2015
02:35 PM
|
0
|
4
|
852
|
POST
|
I have a geodatabase with multiple feature classes in multiple feature datasets. Each feature class has several fields which are identical and will carry the same value. I want to use python to update all of the fields with the user inputted values. I can use sys.argv to get the values but how do I pass them to every field in the geodatabase? I have attached the code I have written so far but nothing gets populated. Any help would be greatly appreciated. TIA.
... View more
01-05-2015
01:18 PM
|
0
|
9
|
6548
|
POST
|
I've been in the field for the last couple of days so a big thanks to those who responded. Hopefully you will still be able to help. I am using sys.argv statements to allow the user to populate the fields in the table. One of those fields will be populated by a dropdown list limited (hopefully by Tool Validator) to a subset of cities that lie within a selected county. The County can either be user designated (sysargv) or preferably selected via mouse. The code I am using is below: #Import modules
import os
import sys
import arcpy
#Set Map Document
mxd = arcpy.mapping.MapDocument("Current")
#Set Overwrite Option
arcpy.env.overwriteOutput = True
#Sets parameters (attributes)
County = sys.argv[1]
Place = sys.argv[2]
CountyName = sys.argv[3]
PlaceName = sys.argv[4]
Office = sys.argv[5]
Forester = sys.srgv[6]
Activity = sys.argv[7]
Persons = sys.argv[8]
Underserverd = sys.argv[9]
NameLast = sys.argv[10]
NameFirst = sys.argv[11]
#Create a new row and fill in fields
rows = arcpy.InsertCursor("CommunityLevelActivity")
row = rows.newRow()
row.TFSOffice = Office
row.TFSForester = Forester
row.Activity = Activity
row.RecipientLast = NameLast
row.RecipientFirst = NameFirst
row.Persons = Persons
row.Underserved = Underserved
row.Place = PlaceName
rows.insertRow(row)
del row
del rows
#Calculate Date Field
expression = datetime.datetime.now()
arcpy.CalculateField_management("CommunityLevelActivity", "DateComplete", expression, "PYTHON_9.3")
# Refresh map to show all changes
arcpy.RefreshActiveView()
mxd.save()
# Refresh map to show all changes
arcpy.RefreshActiveView()
mxd.save()
del mxd, One of the fields in the table is "Place" and this is the one I would like (think I need to use the Tool validator on) to populate using places (PlacesFC -a point FC) that are within a selected county Fc (CountyFC -a polygon FC). I am not sure how to include Curt's code into the Tool Validator. Thanks Thanks
... View more
05-17-2013
06:39 AM
|
0
|
0
|
528
|
POST
|
Ok, I just figured that out! (thanks for the help). I get a runtime error saying that the update Parameters() takes no arguments (1 given). In my script that this will be used for, I am updating a tbale using sys.argv statements. I am used to putting these in order in the parameters section of the Add Script dialog box. I entered the first 4 sys.argv statements as you suggested (parameters 0-3) and I think herein lies my problem. Any other suggestions? Thanks for the prompt responses.
... View more
05-14-2013
07:53 AM
|
0
|
0
|
528
|
POST
|
Curtis, Thanks for the help. Could you clarify where and how this code gets applied? When I add the script into the toolbox do I set my parameters here at the Add Script dialog box? I am a little confused with the Tool Validator stuff. Thanks again.
... View more
05-14-2013
06:28 AM
|
0
|
0
|
528
|
POST
|
All, I am trying to populate a Values List in a tool from selected features. I have 2 feature classes (Counties and Places). I am trying to narrow down the Placees that will populate the Values List. I would like the user to specify the County and then the Values List would be populated by selecting the Places inside the County(SelectByLocation). I am thinking that the Tool Validator will be used but not sure if/how. Would it be possible to select the County by mouse click? Thanks.
... View more
05-13-2013
09:52 AM
|
0
|
8
|
803
|
POST
|
Chris, I have 3 mxds (Tract, Soils, Location). All 3 use the same geodatabase feature class in which the user specifies a certain tract (definition query). I have 3 separate python scripts (1 for each map). The first map uses the definition query to zoom and display the tractt and interior polygons over aerial imagery. The second uses the definiton query to clip a soils layer and display tabular data. the third mxd uses the same definition query to show the general tract location as well as some intersecting data. Currently, I have to open each map independently and run it's resepctive script. I would like to run all 3 mxds at once, with a single button push. T should note that the selected polygon (defintion query) needs to be temporary. Thanks.
... View more
09-04-2012
07:16 AM
|
0
|
0
|
262
|
POST
|
What I was hoping to do was apply a definition query across 3 different mxds with 1 script and without opening each mxd individually. The definition query would run a selection by location in one map, a clip process in another and a second select by location function in a third. It is not possible to have a single mxd with all of this in it. Thanks for you help.
... View more
09-04-2012
05:40 AM
|
0
|
0
|
262
|
POST
|
Is it possible to run a pyhton script on an unopened mxd? I was thinking of a havinga "Master" map that users could digitize polygons in and then run a tool that applied their new polygon (as a definition query) to three other mxds. I have scripts that run individually (1 per map) and was hoping to combine them into a single tool. Am I way off base? Is it simply a matter of referencing the three mxds? Thanks.
... View more
08-31-2012
10:38 AM
|
0
|
4
|
547
|
POST
|
Thanks so much for your help. Chris's code worked well in that it populated the field with the proper number. The problem I am having is that newly digitized polygons are also numbered as 1. Should the code be ran on the entire dataset each time after a new polygon is created? I was hoping to assign this sequential number after the polygon is digitized when I am using sys.argvs to assign other attributes. I can always create another tool button that runs this script on the full dataset. Thoughts? Thanks again.
... View more
08-29-2012
06:16 AM
|
0
|
0
|
208
|
POST
|
Greetings. I am working on a project trying to get sequential Plan ID numbers for polygons produced in different year and different counties. I am using the field "County" to derive my County ID number (it is a string) and a "Year" field to derive my year value (alos a string. The format I am looking for is: 2012-401-1 2012-401-2 2012-401-3 2012-363-1 2012-363-2 2011-401-1 2011-401-2 Any help that y'all could provide would be greatly appreciated.
... View more
08-28-2012
01:24 PM
|
0
|
4
|
809
|
POST
|
Greetings. I am writing some code to clip a soils layer based on a selected boundray polygon and want the clipped soils layer "SoilsClip" to have the same symbology and label properties as the source layer "Soils". i am using the UpdateLayer command and keep getting an Assertion Error. Please provide any help you can. Thanks. #Import modules import os import sys import arcpy #Set Map Document mxd = arcpy.mapping.MapDocument("Current") #Set Overwrite Option arcpy.env.overwriteOutput = True #Create Map Layer arcpy.MakeFeatureLayer_management("Boundary", "Boundary_Selection.lyr") #Add Boundary Selection Layer to Layers Data Frame df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0] addLayer = arcpy.mapping.Layer("Boundary_Selection.lyr") arcpy.mapping.AddLayer(df, addLayer) #Set Boundary Selection symbology SymbologyLayer = ("Boundary") lyr = ("Boundary_Selection.lyr") arcpy.ApplySymbologyFromLayer_management (lyr, SymbologyLayer) #Set Layers data frame extent and scale df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0] lyr = arcpy.mapping.ListLayers(mxd, "Boundary", df)[0] df.extent = lyr.getSelectedExtent(False) df.scale = df.scale * 1.15 #Refresh map to show changes arcpy.RefreshActiveView() arcpy.RefreshTOC() ################################################################### #Clip Soils layer, **goes to default gdb** arcpy.Clip_analysis("Soils", "Boundary_Selection.lyr", "SoilsClip") #Insert Layer below Boundary_Selection df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0] refLayer = arcpy.mapping.ListLayers(mxd, "Boundary", df)[0] insertLayer = arcpy.mapping.Layer("SoilsClip") arcpy.mapping.InsertLayer(df, refLayer, insertLayer, "AFTER") #Set Soils Clip Layer symbology #SymbologyLayer = ("Soils") #lyr = ("SoilsClip") #arcpy.ApplySymbologyFromLayer_management (lyr, SymbologyLayer) #Refresh map to show changes arcpy.RefreshActiveView() arcpy.RefreshTOC() #Update SoilsClip Layer arcpy.mapping.UpdateLayer("Layers", "SoilsClip", "Soils", False) #Refresh map to show changes arcpy.RefreshActiveView() arcpy.RefreshTOC() mxd.save() del mxd,
... View more
07-02-2012
08:27 AM
|
0
|
1
|
2730
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|