ArcGIS Desktop

  • ArcGIS Pro
  • ArcMap

  • My Profile
  • Ayuda
  • Sign Out
ArcGIS Desktop

ArcGIS Online

La plataforma de representación cartográfica para tu organización

ArcGIS Desktop

Un completo SIG profesional

ArcGIS Enterprise

SIG en tu empresa

ArcGIS for Developers

Herramientas para crear aplicaciones basadas en la ubicación

ArcGIS Solutions

Plantillas de aplicaciones y mapas gratuitas para tu sector

ArcGIS Marketplace

Obtén aplicaciones y datos para tu organización.

  • Documentación
  • Soporte
Esri
  • Iniciar sesión
user
  • Mi perfil
  • Cerrar sesión

ArcMap

  • Inicio
  • Introducción
  • Cartografiar
  • Analizar
  • Administrar datos
  • Herramientas
  • Extensiones

UpdateLayerTime

  • Resumen
  • Debate
  • Sintaxis
  • Muestra de código

Resumen

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.

Debate

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.

Sintaxis

UpdateLayerTime (data_frame, update_layer, source_layer)
ParámetroExplicaciónTipo de datos
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

Muestra de código

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

  • Inicio
  • Documentación
  • Soporte

Plataforma ArcGIS

  • ArcGIS Online
  • ArcGIS Desktop
  • ArcGIS Enterprise
  • ArcGIS for Developers
  • ArcGIS Solutions
  • ArcGIS Marketplace

Acerca de Esri

  • Quiénes somos
  • Empleo
  • Blog de Esri
  • Conferencia de usuarios
  • Cumbre de desarrolladores
Esri
Díganos su opinión.
Copyright © 2019 Esri. | Privacidad | Legal