Hot answers tagged

3

To answer your specific question "How to iterate through layers of an MXD?" mxd = arcpy.mapping.MapDocument("CURRENT") # Uses your currently open MXD df = arcpy.mapping.ListDataFrames(mxd, '')[0] # Chooses the first dataframe for lyr in arcpy.mapping.ListLayers(mxd, '', df): # Loop through layers # Any tools you want to run on each layer go here ...


3

I have found the solution to my problem. Instead of referencing the dataset within the geodatabase, simply reference the geodatabase. For example: # workspace = output + "\\PlanningSession.gdb\\DIDs" ## Referencing the Feature Dataset workspace = output + "\\PlanningSession.gdb" ## Referencing the GDB lyr = ...


2

That looks correct (assuming you have closed the TextSymbolizer somewhere lower down), but is a fairly minimal style. It is possible that GeoServer is unable to find a good place to draw any of your labels if the lines are very complex and close together, try zooming in and see if any labels appear. Alternatively you might apply a filter to just the ...


1

Here is a script tool version. I use this all the time on both layers and MXDs. Shouldn't make a difference whether or not you are in an SDE or otherwise. import arcpy, os folderPath = arcpy.GetParameterAsText(0) findString = arcpy.GetParameterAsText(1) replaceString = arcpy.GetParameterAsText(2) for root, dirs, files in os.walk(folderPath): for f ...


1

A few small modifications to your code, but replaces each layer with a new layer and keeps the same layer order. Combined everything as elif into the one for, and added the remove into each if. Before: After: import arcpy #Add constants mxd = arcpy.mapping.MapDocument("Current") df = arcpy.mapping.ListDataFrames(mxd,'*')[0] Mylayer = r"D:\Temp\GISSE" ...


1

After being reasonably pointed out to the shortage of my knowledge, I have conducted some further research. Now, it works with the following solution: lines_layer_name = sublayer_names["ODLines"] lines_sublayer = arcpy.mapping.ListLayers(layer_object, lines_layer_name)[0] More reading on this can be done at ArcGIS help



Only top voted, non community-wiki answers of a minimum length are eligible