|
POST
|
There has to be some way to determine if the MXD you are connected to is valid that will at least respect the "try" block instead of completely bombing python. Couldn't agree more. The only other approach I would suggest is quite kludgy - find some content in the 10.1 file that is unique to 10.1, open the file as a string, and look for it. I sure hope Chris or someone else has a better idea! The better, pythonic solution would be to the mxd object not fail in such an ugly way when it finds unexpected data!
... View more
01-02-2013
10:58 AM
|
0
|
0
|
2200
|
|
POST
|
Chris- As you describe, it makes connection to the 10.1 MXD just fine, it's once you try to list the layers that the script crashes. Please define "crash". Does ArcMap die?
... View more
01-02-2013
07:42 AM
|
0
|
0
|
2200
|
|
POST
|
I geographical terms, I think of the saddle point as a mountain pass like in the second picture in the link. From that point, the surface curves up in one direction and down in another. You may want to look at the Curvature tool. Comparing that value with some other measures (slope for example) may help you isolate the area you're interested in.
... View more
12-21-2012
02:10 PM
|
0
|
0
|
3085
|
|
POST
|
I would like to be able to identify saddle points in my grid. Have you tried the Curvature tool? The hydrology tools (Flow Accumulation) may also be get you where you need to go.
... View more
12-20-2012
12:16 PM
|
0
|
0
|
3085
|
|
POST
|
I'm using ArcGIS 10.0 and arcpy.mapping.ListLayers to iterate through the layers in a list of MXDs. my problem is that someon has saved a 10.1 mxd somewhere in the list of MXDs I'm working through. I'd be fine with just skipping that file, but how do I determine what version a MXD file is from Python? Does opening a 10.1 mxd generate an error, as I would expect? In that case the truly Pythonic way is to try it and then ask for forgiveness:
for mxdPath in mxdList:
try:
mxd = arcpy.mapping.MapDocument(mxdPath)
## < do your stuff >
except:
print "Could not open the map document: \"%s\"" % mxdPath
... View more
12-20-2012
12:08 PM
|
0
|
0
|
2200
|
|
POST
|
What is needed to run a Python script as a scheduled task on a server that currently only has ArcSDE 10 and Python 2.6 installed on it? Since the ArcSDE command "sdelocator" is no longer available starting with ArcSDE 10, I created a model on my ArcGIS 10 desktop PC and exported it to a python script to rebuild my ArcSDE-based locators. When I try to manually run the script on the ArcSDE server, I get the "ImportError: No module named arcpy" message. The solution (according to the help information) is to add a Desktop10.pth file containing references (paths) to the Desktop10.0\arcpy and Desktop10.0\bin folders into the C:\python26\Lib\site-packages folder but in order to access the arcpy and bin folders, it seems that will I also need to install Desktop 10 on my ArcSDE server in order to access these folders. My infrastructure guys are concerned about having to load all this extra software on our main GIS data server just to run a script. If you have ArcGIS Server installed on the SDE server, it should have arcpy in its install folder.
... View more
12-20-2012
11:58 AM
|
0
|
0
|
1121
|
|
POST
|
I have a point shapefile with 365 (daily for 1 year) data columns. I need to run an IDW for each column, 365 in total. I have done this as a batch process in the past. Is there any way to get the Z-value field and Output raster entries in the batch to fill sequentially? Or any other way to do this? I played with Model Builder a bit, but couldn't find an option there either. If you have ArcGIS 10, Model Builder is definitely the way to do this. You can use the For iterator (1...365) and use your for variable (%k%) in the input field "D%k%" output dataset name: "out%k%". Batch is an older technique from 9x that can be helpful, but IMHO the 10x Model Builder iteration is generally a more effective way to do such things.
... View more
12-15-2012
10:44 PM
|
0
|
0
|
966
|
|
POST
|
If you put the function into a python module "mystuff.py" and import it, then it will be available (with its documentation string, if any) from the python command window. But why not make yourself a .pyt or .tbx toolbox and import it with arcpy.ImportToolbox? This will show both tool and parameter usage documentation while you're using it and allow you to access picklists for the parameters on the command line.
... View more
12-12-2012
08:20 AM
|
0
|
0
|
974
|
|
POST
|
I wasn't even aware of curly quotes and not sure how I even typed them. Beware the curse of the curly quotes (in Microsoft Word): http://www.techrepublic.com/blog/msoffice/turn-off-words-smart-quotes/1547 If you're not using an IDE (like IDLE or PythonWin) to edit your Python code, I highly recommend it -- because of the requirement for fanatically accurate indentation!
... View more
12-12-2012
08:08 AM
|
0
|
0
|
1145
|
|
POST
|
I'm still getting syntax errors during the 'set the text property of the text element equal to the value from the fields' portion of the code. - You need to indent all statements inside the loop (have you run through the Python tutorial at Python.org?) - As I mentioned, avoid the curly quotes, your options are straight single and double quotes. for row in rows:
RtNumElem.text = row.getValue("RTNUM")
CoElem.text = row.getValue("County")
LocElem.text = row.getValue(�??Location�?�)
(...)
... View more
12-12-2012
07:52 AM
|
0
|
0
|
1145
|