def closeVisible(scale): if scale < 500000: return True else: return False def farVisible(scale) if scale > 500000: return True else: return False
layer1.visible = closeVisible(dataframe.scale) layer2.visible = farVisible(dataframe.scale)
At 10.0, this requires a bit of extra logic but it is possible. You would need to add your layer file multiple times, uniquely name each layer and then check the data frame scale and turn on/off layers....
import arcpy mxd = arcpy.mapping.MapDocument(r"J:\users\harromi\replacesource\dummy.mxd") sdepath = r"Z:\webapp\mapservices\Maps\connection-files\DEV\GISCO-DEV-direct-giscoread.sde" for lyr in arcpy.mapping.ListBrokenDataSources(mxd): if lyr.supports("DATASOURCE"): if lyr.dataSource == r"H:\MyDocuments\ArcGIS\Default.gdb\Export_Output": lyr.replaceDataSource(sdepath, "SDE_WORKSPACE", "GISCOVIEW.STAT_LIFEXF_NUTS2_2006_8_01M", True) lyr.name = "LifeEX" mxd.saveACopy(r"H:\MyDocuments\ArcGIS\Untitled6.mxd")
Los miembros registrados pueden publicar, seguir actualizaciones y más. ¿Nuevo aquí? Regístrate gratis.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.