Tag Info

New answers tagged

0

Ok, I solved it myself. The problem was that it could not read the name of the layer to be added to group. for dirpath, dirnames, filenames in arcpy.da.Walk(r"Z:/IMAGES/MAPS/15_Min_Thematic_Maps",topdown=True, followlinks=True, type="TIF"): for filename in filenames: if Sel in filename.upper(): print filename ...


1

I have also had issues with this...This post was helpful. In our case, we have 50+ mxd's we use for web applications, each with a corresponding SDE database. We just upgraded our SDE and ArcGIS Server so I used the lyr.replaceDataSource to explicitly set the SDE workspace and it seemed to work much better. It still missed a few, but for some reason I can ...


1

This is because you are giving the layer the full path name when you create the Raster Layer. This is what you are doing: arcpy.MakeRasterLayer_management(Raster(layerName),layer) The output argument "layer" is a full file path. What you should change it to is this: arcpy.MakeRasterLayer_management(Raster(layerName),layerName) This will give you ...


2

Here's a different way to do this by setting the dataframe equal to the current layer's extent. It a lot more simple. Also, you'd better check your path because it shows the MXD being inside the geodatabase. import arcpy import os path = "C:\\Users\\Et\\Documents\\ArcGIS" #need to use two backslashes mxd = arcpy.mapping.MapDocument(os.path.join(path, ...


1

Try this code: import arcpy,os,sys import arcpy.mapping from arcpy import env env.workspace = r"C:\Project" for mxd in arcpy.ListFiles("*.mxd"): print mxd # print list of mxd's in the folder mapdoc = arcpy.mapping.MapDocument(r"C:\Project\\" + mxd) df = arcpy.mapping.ListDataFrames(mapdoc, "Layers")[0] ...



Top 50 recent answers are included