Anuncio : Todos los proyectos no comerciales registrados para usar Earth Engine antes del
15 de abril de 2025 deben
verificar su elegibilidad no comercial para mantener el acceso. Si no realizas la verificación antes del 26 de septiembre de 2025, es posible que se suspenda tu acceso.
Enviar comentarios
ee.Image.arrayLength
Organiza tus páginas con colecciones
Guarda y categoriza el contenido según tus preferencias.
Devuelve la longitud del array de cada píxel a lo largo del eje determinado.
Uso Muestra Image. arrayLength (axis)
Imagen
Argumento Tipo Detalles esta: input
Imagen Imagen de entrada. axis
Número entero Eje a lo largo del cual se toma la longitud.
Ejemplos
Editor de código (JavaScript)
// A function to print arrays for a selected pixel in the following examples.
function sampArrImg ( arrImg ) {
var point = ee . Geometry . Point ([ - 121 , 42 ]);
return arrImg . sample ( point , 500 ). first (). get ( 'array' );
}
// A 3-band image of constants.
var img = ee . Image ([ 0 , 1 , 2 ]);
print ( '3-band image' , img );
// Convert the 3-band image to a 2D array image.
var arrayImg2D = img . toArray (). toArray ( 1 );
print ( '2D array image (pixel)' , sampArrImg ( arrayImg2D ));
// [[0],
// [1],
// [2]]
// Get the number of dimensions in each pixel's array.
var arrayImg2Ddim = arrayImg2D . arrayDimensions ();
print ( 'N dimensions in array' , sampArrImg ( arrayImg2Ddim ));
// 2
// Get the array length per dimension per pixel.
var arrayImg2DdimLen = arrayImg2D . arrayLengths ();
print ( 'Array length per dimension' , sampArrImg ( arrayImg2DdimLen ));
// [3, 1]
// Get the array length for 0-axis (rows).
var arrayImg2Daxis0Len = arrayImg2D . arrayLength ( 0 );
print ( 'Array length 0-axis (rows)' , sampArrImg ( arrayImg2Daxis0Len ));
// 3
// Get the array length for 1-axis (columns).
var arrayImg2Daxis1Len = arrayImg2D . arrayLength ( 1 );
print ( 'Array length 1-axis (columns)' , sampArrImg ( arrayImg2Daxis1Len ));
// 1
Configuración de Python
Consulta la página
Entorno de Python para obtener información sobre la API de Python y el uso de geemap
para el desarrollo interactivo.
import ee
import geemap.core as geemap
Colab (Python)
# A function to print arrays for a selected pixel in the following examples.
def samp_arr_img ( arr_img ):
point = ee . Geometry . Point ([ - 121 , 42 ])
return arr_img . sample ( point , 500 ) . first () . get ( 'array' )
# A 3-band image of constants.
img = ee . Image ([ 0 , 1 , 2 ])
print ( '3-band image:' , img . getInfo ())
# Convert the 3-band image to a 2D array image.
array_img_2d = img . toArray () . toArray ( 1 )
print ( '2D array image (pixel):' , samp_arr_img ( array_img_2d ) . getInfo ())
# [[0],
# [1],
# [2]]
# Get the number of dimensions in each pixel's array.
array_img2d_dim = array_img_2d . arrayDimensions ()
print ( 'N dimensions in array:' , samp_arr_img ( array_img2d_dim ) . getInfo ())
# 2
# Get the array length per dimension per pixel.
array_img_2d_dim_len = array_img_2d . arrayLengths ()
print (
'Array length per dimension:' ,
samp_arr_img ( array_img_2d_dim_len ) . getInfo ()
)
# [3, 1]
# Get the array length for 0-axis (rows).
array_img2d_axis0_len = array_img_2d . arrayLength ( 0 )
print (
'Array length 0-axis (rows):' ,
samp_arr_img ( array_img2d_axis0_len ) . getInfo ()
)
# 3
# Get the array length for 1-axis (columns).
array_img_2d_axis1_len = array_img_2d . arrayLength ( 1 )
print (
'Array length 1-axis (columns):' ,
samp_arr_img ( array_img_2d_axis1_len ) . getInfo ()
)
# 1
Enviar comentarios
Salvo que se indique lo contrario, el contenido de esta página está sujeto a la licencia Atribución 4.0 de Creative Commons , y los ejemplos de código están sujetos a la licencia Apache 2.0 . Para obtener más información, consulta las políticas del sitio de Google Developers . Java es una marca registrada de Oracle o sus afiliados.
Última actualización: 2025-07-26 (UTC)
¿Quieres brindar más información?
[[["Fácil de comprender","easyToUnderstand","thumb-up"],["Resolvió mi problema","solvedMyProblem","thumb-up"],["Otro","otherUp","thumb-up"]],[["Falta la información que necesito","missingTheInformationINeed","thumb-down"],["Muy complicado o demasiados pasos","tooComplicatedTooManySteps","thumb-down"],["Desactualizado","outOfDate","thumb-down"],["Problema de traducción","translationIssue","thumb-down"],["Problema con las muestras o los códigos","samplesCodeIssue","thumb-down"],["Otro","otherDown","thumb-down"]],["Última actualización: 2025-07-26 (UTC)"],[],[]]