What is the syntax to retrieve all layers' set minimum scale ?
for layer in layers: if layer.isFeatureLayer: lyr_source = layer.dataSource lyr_name = layer.name.encode("utf8", "replace") print fullpath + " " + lyr_source + " " + str(layer.minScale) scale = [layer.minScale] # Write to Excel b = fullpath.split('\\') + lyr_source.split('\\') + scale writer.writerow(b)
Thanks, everyone I arrived at my final solution.
not sure what you mean beyond it returning a double (number). Are you wanting to cycle through all the layers and return the minScale for each? Did you try something and it didn't work?
I haven't tried anything yet and yes you are correct as I did not have any luck searching the internet to achieve this.
The arcpy help is your best bet... this is the layer section
and from there, nothing too exciting ... maybe... mylayer.minScale if it is property
Provides the ability to set or get the layer's minimum scale threshold.
As for arcpy.... bookmark the start of its menu tree... Arcpy ... , Dr Google isn't very good at tracking down all the properties and methods
I know that it can be done, documentation is lacking.
mxd = arcpy.mapping.MapDocument("CURRENT")for lyr in arcpy.mapping.ListLayers(mxd): # to read minScale print lyr.minScale # to set minScale lyr.minScale = 500.0
Perfect, I arrived at the same.
Make sense, set the mxd and loop layers.
I will add this to an existing script that write data to csv.
Retrieving data ...