|
POST
|
It may have something to do with your geoprocessing options. Try Geoprocessing > Geoprocessing Options and experiment with the "Add results of geoprocessing operations to the display" checkbox.
... View more
04-03-2014
06:25 AM
|
0
|
0
|
1181
|
|
POST
|
Hi there, you can definitely do this, subfolders and all. No file moving necessary. Here is the skeleton of the code you will need: import os, arcpy #here's an example of how to run through all the layers in an mxd def SetDefQueries(mxdobject, defquery): fixed_layers = [] for layer in arcpy.mapping.ListLayers(mxdobject): #this should weed out the group layers and rasters if layer.supports("DEFINTIONQUERY"): fixed_layers.append(layer.name) layer.definitionQuery = defquery #have the function return a list summary of the layers that were changed (for fun) return fixed_layers #create and print query query = '"VALIDATIONSTATE" = 3' #may have to fix the syntax of this statement depending on the field type arcpy.AddMessage(query) #to go through all of the folder, use os.walk(), you can find documentation on the python website for path, dirs, files in os.walk(top/folder/path): for f in files: if f.endswith(".mxd"): #this should get you all of the mxds in all of the folders. mxd_path = path + "\\" + f arcpy.AddMessage(mxd_path) #now you can make arcpy.mapping.MapDocument() objects mxd = arcpy.mapping.MapDocumentmxd_path) #use the SetDefQuery function on the mxd changed_layers = SetDefQuery(mxd, query) #print a summary of what happened arcpy.AddMessage("In {}:".format(mxd_path)) lyrs_summary = "\n ".join(changed_layers) arcpy.AddMessage(lyrs_summary) #save the mxd at the end (won't work if you have it open) mxd.save() You may need to do a little bit of trouble shooting, but this should serve as a good basis for what you need in the end. You could run it straight from a .py file on the desktop if you just change the arcpy.AddMessage() pieces to normal print statements. Also, this is from my experience in 10.0, but I'm fairly certain that these things work the same way in 10.x
... View more
04-02-2014
06:03 AM
|
0
|
0
|
1923
|
|
POST
|
Hello jlaroussi, try this thread: http://forums.arcgis.com/threads/105463-Alternative-to-Using-getValue-with-Data-Access-Module
... View more
03-27-2014
12:04 PM
|
0
|
0
|
2024
|
|
POST
|
Well, I guess I would just suggest printing all of the parameters when you get them as text at the beginning of the script, and also printing all of the corresponding variables in the hard-coded version. It sounds like there is some value or object type issue. Perhaps you are getting something as text that you previously used as an object? I don't know a whole lot about raster processing, so can't be much more help...
... View more
03-25-2014
01:36 PM
|
0
|
0
|
1173
|
|
POST
|
I think the issue is you are not escaping the '\' characters when you set the workspace path and when you create the output path string. You should use r"\Scratch.gdb" or "\\Scratch.gdb" any time you need to construct a path.
... View more
03-25-2014
11:31 AM
|
0
|
0
|
1173
|
|
POST
|
Ok yeah, sure does look like you need to install setuptools. This should be helpful: https://pypi.python.org/pypi/setuptools#installation-instructions
... View more
03-25-2014
05:46 AM
|
0
|
0
|
1995
|
|
POST
|
Hmm, it may help to add those operations to the initializeParameters() method in the ToolValidator class for each tool, so that the parameters are definitely referencing an up-to-date mxd. Otherwise storing those temp feature classes in "in_memory\" instead of a scratch gdb may help too.
... View more
03-24-2014
08:33 AM
|
0
|
0
|
5858
|
|
POST
|
Maybe try arcpy.RefreshTOC() and arcpy.RefreshActiveView() after you delete the temporary layers?
... View more
03-24-2014
07:53 AM
|
0
|
0
|
5858
|
|
POST
|
I don't think you need to install anything new prior to following the steps I outlined above. Give it a shot and let me know how it goes.
... View more
03-24-2014
05:48 AM
|
0
|
0
|
1995
|
|
POST
|
There are a few different ways to install python modules, here's the real explanation: http://docs.python.org/2/install/ The steps I just took to install this one: 1. download the .tar.gz from the link above. 2. unzip so you are left with a folder called "pyBarcode-0.7" 3. put it in an easy to reach location, like c:\pyBarcode-0.7 4. open the command prompt (start menu, type "cmd" into the search box) 5. navigate to the pyBarcode-0.7 folder (type "cd c:\pyBarcode-0.7") 6. run the install command on the setup.py (type "setup.py install") The setup.py script should copy all of the necessary files to you python folder, and you should be able to import and use the module in any scripts.
... View more
03-21-2014
01:37 PM
|
0
|
0
|
1995
|
|
POST
|
Hi Tom, I've written a script to do exactly this. I use it all the time. It selects a state plane zone based on the current extent of the data frame, and if the extent spans more than one zone it will add the zone layer to the display so the user can zoom in and rerun the tool. It shouldn't be too difficult to modify the code for your own needs. I've packaged the toolbox, prj files, and script in this zipfile. Just unzip this folder and add the toolbox to ArcMap. Make sure all the little files stay in the folder just as they are. Are you using 10.1? If so, I may take this opportunity to finally turn this concept into an addin. Adam
... View more
03-20-2014
06:20 AM
|
0
|
0
|
964
|
|
POST
|
I think there are two problems. First, the expression you enter need only be what you would use in field calculator, i.e. "!Name_Sin!", instead of "!TextString! = !Name_Sin!". Second, when you have a joined table, the name of the feature class and a period are added to the field name as a prefix. So, when you have this table joined, you will want to write "!<feature class name>.Name_Sin!". The easiest way to double check this is to perform the join in ArcMap, and then open the table and view the properties of various fields to see their respective names. Hope that solves it! Adam
... View more
03-13-2014
10:54 AM
|
0
|
0
|
327
|
|
POST
|
Here are the basic steps I've used to do something similar to this: 1. make 10 different layer files, each for a polygon with one your 10 different colors (or however many you'd like to have) (set symbology on any polygon feature class in ArcMap to a simple color outline symbol and then right-click and "Save As Layer File") 2. place them all in the same folder and name them "color1.lyr", "color2.lyr", etc. 3. add a color field to each parcel feature and enter the desired color. 4. when adding layers to the TOC with python, use the value in the color field to set the definition query, or use the parcel number if you want separate layers for each parcel. You can then name the layers with the parcel number. 5. use the value in the color field to construct the path to the correct layer file on disk and then use ApplySymbologyFromLayer Dealing with the various layer objects in arcpy has been a little confusing to me, so be thorough and get ready for some trial and error. I've found it necessary in some cases to use the Layer method to make the initial layer which will be added to the display, and then to use ListLayers to create a "layer as it appears in the TOC" object. Hope this is helpful, Adam
... View more
03-13-2014
08:47 AM
|
0
|
0
|
560
|
|
POST
|
I was having the exact same issue yesterday. I was using I kind of resolved it, but still don't quite know what's going on. One thing I noticed was that while I was in ArcMap and looking at the excel files in the ArcCatalog window, whenever I was getting the error I was also not able to expand the xls file to show the individual sheets within it. I would get a "dataset doesn't exist or is not supported" type of error. Basically, I'm thinking that it comes down to some sort of permissions issue. I was able to get things to work by alternately closing the python shell/IDLE as well as reopening ArcMap. Also, refreshing the folder in the catalog window helps. Eventually I was able to expand the file in the catalogue window, and also run the scripts. Not sure if this is helpful, but good luck! It may be worth importing the table to a geodatabase, and using it from there.
... View more
02-20-2014
06:44 AM
|
0
|
0
|
838
|
|
POST
|
Hi, I'm not exactly clear on what you're trying to do. My best guess is that you are using one field in shapefile A to decide whether or not to add information from shapefile B to a different field in shapefile A. If this is so, some more details/code would be very helpful in figuring this out. Field calculator may also work for this, because you could build a function into the calculation...
... View more
01-20-2014
05:53 AM
|
0
|
0
|
1054
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 04-03-2015 07:41 AM | |
| 1 | 04-02-2015 03:42 PM | |
| 3 | 08-14-2014 09:58 AM | |
| 1 | 08-12-2014 07:10 AM |
| Online Status |
Offline
|
| Date Last Visited |
11-11-2020
02:24 AM
|