POST
|
Hello, I am having exactly the same problem as Lin above. I am using ArcGIS 10.1 and HEC-GeoRas for 10.1. I cannot for the life of me locate a "classic" import option. Is this choice within ArcGIS or is it selected on export from within HEC-RAS? thanks in advance, Steve
... View more
04-09-2013
10:41 AM
|
0
|
0
|
974
|
POST
|
I too have encountered this problem since 'upgrading' to 10.1. The tool behaved normally in 10.0, but now it does not consistently identify from the profile. It seems to work best on steep portions of the profile. Selecting profile segments is also spotty. I get the problem both from 3d line features and from graphic line interpolations.
... View more
08-30-2012
01:06 PM
|
0
|
0
|
245
|
POST
|
"I may have found the issue. It helps to try real scripts against real MXDs. Change this line: lyr.findAndReplaceWorkspacePath(r"G:\US_Army_COE_Sac\ERS\Ft_Irwin", r"G:\US_Army_COE_Sac","FALSE") To: lyr.findAndReplaceWorkspacePath(r"G:\US_Army_COE_Sac\ERS\Ft_Irwin", r"G:\US_Army_COE_Sac", False) The validation parameter is a Python Boolean, not a string. You want to use False with an upper case "F", lower case "alse") Jeff" The above worked perfectly! Thanks again!
... View more
05-16-2012
03:22 PM
|
0
|
0
|
347
|
POST
|
Sweet! Thank you that works well! Steve Looks like i spoke a bit too soon. Now it is throwing this error: Executing: MXDSourceUpdate G:\US_Army_COE_Sac\ERS\Ft_Irwin\_MXDs\_Reports\Workplan G:\US_Army_COE_Sac\ERS G:\US_Army_COE_Sac\ERS\Ft_Irwin Start Time: Tue May 15 17:00:57 2012 Running script MXDSourceUpdate... Traceback (most recent call last): File "D:\TEMP\_Python\mxd_source_update_20120515.py", line 33, in <module> lyr.findAndReplaceWorkspacePath(origSource2, newSource2,"FALSE") File "C:\Program Files\ArcGIS\Desktop10.0\arcpy\arcpy\utils.py", line 181, in fn_ return fn(*args, **kw) File "C:\Program Files\ArcGIS\Desktop10.0\arcpy\arcpy\_mapping.py", line 601, in findAndReplaceWorkspacePath return convertArcObjectToPythonObject(self._arc_object.findAndReplaceWorkspacePath(*gp_fixargs((find_workspace_path, replace_workspace_path, validate), True))) ValueError: Layer: Unexpected error Layer: Unexpected error Completed script MXDSourceUpdate... Failed to execute (MXDSourceUpdate). Failed at Tue May 15 17:01:00 2012 (Elapsed Time: 3.00 seconds) I am not sure, but is seems like the arcpy module is trying to validate the paths. My understanding was the script would work regardless of whether or not it found a valid path. I tried explicitly setting the validation to "FALSE" which yielded the same result. My MXDs typically have layers referencing many sources, I was hoping this tool would function as a true find and replace. That is, it would ignore any layers in which it did not "find" the search string. Any ideas? Here is my code: import arcpy, os try: #Read input parameters from GP dialog folderPath = arcpy.GetParameterAsText(0) origSource = arcpy.GetParameterAsText(1) newSource = arcpy.GetParameterAsText(2) #Loop through each MXD file origSource2 = origSource.replace("\\","/") newSource2 = newSource.replace("\\","/") for filename in os.listdir(folderPath): fullpath = os.path.join(folderPath, filename) if os.path.isfile(fullpath): basename, extension = os.path.splitext(fullpath) if extension.lower() == ".mxd": mxd = arcpy.mapping.MapDocument(fullpath) print fullpath + "\n\n...Checking" for lyr in arcpy.mapping.ListLayers(mxd): if lyr.supports("DATASOURCE") and lyr.supports("DATASETNAME"): lyr.findAndReplaceWorkspacePath(origSource2, newSource2,"FALSE") print fullpath + "\n\n...Updated" mxd.save() del mxd #Delete variables that reference data on disk del folderPath, origSource, newSource, filename, fullpath except Exception, e: import traceback map(arcpy.AddError, traceback.format_exc().split("\n")) arcpy.AddError(str(e)) BTW it actually still crashes completely if I try to use mxd.findAndReplaceWorkspacePaths() after the layer test. I would prefer this method as it is supposed to update all layers including table layers which are apparently missed by the layer.findAndReplaceWorkspacePath()... but maybe i am just missing something?
... View more
05-15-2012
04:23 PM
|
0
|
0
|
347
|
POST
|
Hello Jeff, I, too, am having a great deal of trouble with this issue. I am running ArcGIS 10 SP4 and attempting the following: import arcpy, os folderPath = r"G:\US_Army_COE_Sac\ERS\Ft_Irwin\_MXDs\Checker" for filename in os.listdir(folderPath): fullpath = os.path.join(folderPath, filename) if os.path.isfile(fullpath): basename, extension = os.path.splitext(fullpath) if extension.lower() == ".mxd": print fullpath + "\n...Checking" mxd = arcpy.mapping.MapDocument(fullpath) for lyr in arcpy.mapping.ListLayers(mxd): if lyr.supports("DATASOURCE"): mxd.findAndReplaceWorkspacePaths(r"G:\US_Army_COE_Sac", r"G:\US_Army_COE_Sac\ERS\Ft_Irwin") print fullpath + "...Updated" mxd.save() del mxd I have also tried looping through each layer after the "DATASOURCE" test using layer.findAndReplaceWorkspacePath() with the same result of a full crash. The MXDs each have a Bing streaming imagery layer in the TOC and the script works fine if i remove it. Thanks in advance for any ideas on why this is still not working.... Steve
... View more
05-14-2012
12:11 PM
|
0
|
0
|
347
|