ArcGIS Desktop

  • ArcGIS Pro
  • ArcMap

  • My Profile
  • Aide
  • Sign Out
ArcGIS Desktop

ArcGIS Online

La plateforme cartographique de votre organisation

ArcGIS Desktop

Un SIG professionnel complet

ArcGIS Enterprise

SIG dans votre entreprise

ArcGIS Developers

Outils de création d'applications de localisation

ArcGIS Solutions

Modèles d'applications et de cartes gratuits pour votre secteur d'activité

ArcGIS Marketplace

Téléchargez des applications et des données pour votre organisation.

  • Documentation
  • Support
Esri
  • Se connecter
user
  • Mon profil
  • Déconnexion

ArcMap

  • Accueil
  • Commencer
  • Carte
  • Analyser
  • Gérer les données
  • Outils
  • Extensions

UpdateLayerTime

  • Résumé
  • Discussion
  • Syntaxe
  • Exemple de code

Résumé

Provides the ability to update a layer's time properties for a layer in a map document (.mxd) by extracting time properties from a source layer.

Discussion

The UpdateLayer function has the ability to only update a layer's symbology properties or update ALL layer properties, including time properties.

The UpdateLayerTime function allows you to update only the time properties of a layer and therefore won't overwrite other layer properties that you don't want to change.

The source_layer contains the time properies that you want to apply. It can either be a layer file on disk or a reference to another layer in a map document.

If you want to update the properties for a layer within a layer file, you must modify the properties of the layer in a map document first and then save the changes back to a layer file. See the Layer object's save or saveACopy methods and the code example below.

Syntaxe

UpdateLayerTime (data_frame, update_layer, source_layer)
ParamètreExplicationType de données
data_frame

A reference to a DataFrame object that contains the layer to be updated.

DataFrame
update_layer

A Layer object representing an existing layer that will be updated.

Layer
source_layer

A reference to a Layer object that contains the information to be applied to the update_layer.

Layer

Exemple de code

UpdateLayerTime example 1

The following script will update a layer's time properties using a layer file. The layer called temperature is not time enabled. The time properties of a time-enabled layer file will be applied to the temperature layer.

import arcpy

mxd = arcpy.mapping.MapDocument(r"C:\Project\Temperature.mxd")
df = arcpy.mapping.ListDataFrames(mxd, "World")[0]
lyr = arcpy.mapping.ListLayers(mxd, "temperature", df)[0]
lyrFile = arcpy.mapping.Layer(r"C:\Project\Data\Time\LayerWithTimeProperties.lyr")
arcpy.mapping.UpdateLayerTime(df, lyr, lyrFile)

# Save changes to a new MXD
mxd.saveACopy(r"C:\Project\Temperature2.mxd")
# Clean up variables
del mxd, df, lyr, lyrFile
UpdateLayerTime example 2

The following script is similar to the one above but saves the changes back out to a layer file.

import arcpy

mxd = arcpy.mapping.MapDocument(r"C:\Project\Temperature.mxd")
df = arcpy.mapping.ListDataFrames(mxd, "World")[0]
lyr = arcpy.mapping.ListLayers(mxd, "temperature", df)[0]
lyrFile = arcpy.mapping.Layer(r"C:\Project\Data\Time\LayerWithTimeProperties.lyr") #orginally authored in ArcMap
arcpy.mapping.UpdateLayerTime(df, lyr, lyrFile)

# Save changes to a new Layer file
lyr.saveACopy(r"C:\Project\TemperatureWithTime.lyr")
# Clean up variables
del mxd, df, lyr, lyrFile

ArcGIS Desktop

  • Accueil
  • Documentation
  • Support

ArcGIS

  • ArcGIS Online
  • ArcGIS Desktop
  • ArcGIS Enterprise
  • ArcGIS
  • ArcGIS Developer
  • ArcGIS Solutions
  • ArcGIS Marketplace

A propos d'Esri

  • A propos de la société
  • Carrières
  • Blog d’Esri
  • Conférence des utilisateurs
  • Sommet des développeurs
Esri
Donnez-nous votre avis.
Copyright © 2021 Esri. | Confidentialité | Légal