LayerFileLocation = "H:\Documents\GIS\HydstraData" LayerName = "CasedContours.lyr" lyr = os.path.join(LayerFileLocation,LayerName) arcpy.mapping.Layer(lyr).supports("TIME") lyrTime = lyr.Time
if lyr.supports("TIME"): lyrTime = lyr.time if lyr.time.isTimeEnabled: ... ...
if Wells_lyr.supports("TIME"): arcpy.AddMessage("TIME is supported.") if Wells_lyr.time.isTimeEnabled: arcpy.AddMessage("TIME is enabled.")
##Enable time for the layer. arcpy.mapping.Layer(Wells_lyr).supports("TIME")
## Step 1 import arcpy import arcpy.mapping import os OutFolderPath = "H:\Documents\GIS\HydstraData\HydstraMeasurementsDeep" GeoDatabaseName = "GSE_Daily_Contours_20130625_20130625.gdb" LayerFileLocation = "H:\Documents\GIS\HydstraData" ##Reference the Current map document. mxd = arcpy.mapping.MapDocument("CURRENT") df = arcpy.mapping.ListDataFrames(mxd)[0] ##arcpy.env.workspace = GeoDatabaseName arcpy.env.workspace = "H:\Documents\GIS\HydstraData" ##Add AllPoints Featureclass to map. WellsPtsLyrFile = os.path.join(LayerFileLocation,"Template_WellPoints.lyr") ##print Wells_lyr arcpy.AddMessage(Wells_lyr) Wells_lyr = arcpy.mapping.Layer(WellPtsLyrFile) ##Replace the Layer DataSource. Wells_lyr.replaceDataSource(os.path.join(OutFolderPath,GeoDatabaseName),"NONE","WellPoints") ##Show labels for WellPoints. if Wells_lyr.supports("LABELCLASSES"): Wells_lyr.labelClasses[0].expression = "[StateWellNumber]" Wells_lyr.showLabels = True ##Enable time for the layer. arcpy.mapping.Layer(Wells_lyr).supports("TIME") arcpy.mapping.AddLayer(df, Wells_lyr, "AUTO_ARRANGE")
Les membres connectés peuvent publier, suivre les mises à jour, et plus encore. Nouveau ici ? Inscrivez-vous gratuitement.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.