Tag Info

New answers tagged

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, ...


0

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] ...


1

The only types of layers you can add to an mxd with arcpy.mapping are map layers (layers in an mxd), and layer files (.lyr). A feature layer (in-memory layer) you create using the Make Feature Layer tool is not valid. In addition, Make Feature Layer doesn't accept topologies as input (a topology is a dataset, not a feature class). You can export a ...



Top 50 recent answers are included