Hot answers tagged

6

You need to change your view in the Table of Contents. You are currently looking at the "List by Source View" This view does not let you re-order layers. In order to do that, you need to change to the "List by Drawing Order" view. You can tell you are in the drawing order view because the layer source path disappears from the Table of Contents listing.


3

I figured it out! It was something very small. Basically, the layers you would like to see displayed on the canvas is provided through canvas.setLayerSet(list_of_layers). # total list of layers actually displayed on map canvas canvas_layers = [] # load vector layers for files in os.listdir(source_dir): # load only the shapefiles if files.endswith("...


3

Something like the following should work. It creates a list of all the layers in your MXD, then loops through the Group Layers and adds them to a list. If the Group Layer already exists in the list (i.e. a duplicate) then it's removed instead. import arcpy mxd = arcpy.mapping.MapDocument("CURRENT") df = arcpy.mapping.ListDataFrames(mxd)[0] allLayers = ...


3

This code will do all the job for you, this code is tested - it works. import arcpy mxd = arcpy.mapping.MapDocument(r"G:\!Some_project_delete\!Some_project_delete.mxd") groups_list = [] for df in arcpy.mapping.ListDataFrames(mxd): # iterate over dataframes for lyr in arcpy.mapping.ListLayers(mxd, "", df): # iterate over layers if lyr....


2

It would be the same as iterating through the layers. mxd = arcpy.mapping.MapDocument("CURRENT") # Uses your currently open MXD for df in arcpy.mapping.ListDataFrames(mxd, ''): # Loop through dataframes for lyr in arcpy.mapping.ListLayers(mxd, '', df): # Loop through layers # Any tools you want to run on each layer go here


2

Esri has a good help section on Working with group layers. Here are two approaches: 1) Select all the layers you want to group in the table of contents > right click selected layers > Group 2) Add a new group layer by right-clicking on the layers in the table of contents. Then simply drag and drop or add layers into the group. Make sure to select the ...


2

Since Winners is a list of integers, and MakeFeatureLayer is expecting a SQL string in a particular format, you need to convert. Here's a simple way: >>> Winners = [1, 4, 59, 330] >>> sql = "OBJECTID_12 IN ({})".format(",".join(map(str, Winners))) >>> print(sql) 'OBJECTID_12 IN (1,4,59,330)' Since your values are integers, you ...


2

If your mxd is open, use mxdloc = arcpy.mapping.MapDocument("CURRENT") Changes made to your mxd on your disk (by referencing the mxd's path) won't be visible if the mxd is open in ArcMap so depending on where you are running it you may need to add mxdloc.save()


1

Do read the Leaflet tutorial on using WMS - it specifically addresses how to use WMS services in other projections. Also note that you can not have raster layers in different CRSs in Leaflet. It's simply not supported due to the complexity of on-the-fly raster reprojection.



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