Annuncio : tutti i progetti non commerciali registrati per l'utilizzo di Earth Engine prima del
15 aprile 2025 devono
verificare l'idoneità non commerciale per mantenere l'accesso. Se non hai eseguito la verifica entro il 26 settembre 2025, il tuo accesso potrebbe essere sospeso.
Invia feedback
ee.Number.toInt64
Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Esegue il cast del valore di input a un numero intero a 64 bit con segno.
Utilizzo Resi Number. toInt64 ()
Numero
Argomento Tipo Dettagli questo: input
Numero Il valore dell'input.
Esempi
Editor di codice (JavaScript)
// Cast a number to signed 64-bit integer: [-9223372036854776000, 9223372036854776000].
var number = ee . Number ( 100 );
print ( 'Number:' , number );
var int64Number = number . toInt64 ();
print ( 'Number cast to int64:' , int64Number );
/**
* Casting numbers to int64 that are outside of its range and precision can
* modify the resulting value, note the behavior of the following scenarios.
*/
// A floating point number cast to int64 loses decimal precision.
var float = ee . Number ( 1.7 );
print ( 'Floating point value:' , float );
var floatToInt64 = float . toInt64 ();
print ( 'Floating point value cast to int64:' , floatToInt64 );
// A number greater than int64 range max cast to int64 becomes int64 range max.
var INT64_MAX = 9223372036854776000 ;
var outOfRangeHi = ee . Number ( INT64_MAX + 12345 );
print ( 'Greater than int64 max:' , outOfRangeHi );
var outOfRangeHiToInt64 = outOfRangeHi . toInt64 ();
print ( 'Greater than int64 max cast to int64 becomes int64 max:' , outOfRangeHiToInt64 );
// A number greater than int64 range min cast to int64 becomes int64 range min.
var INT64_MIN = - 9223372036854776000 ;
var outOfRangeLo = ee . Number ( INT64_MIN - 12345 );
print ( 'Less than int64 min:' , outOfRangeLo );
var outOfRangeLoToInt64 = outOfRangeLo . toInt64 ();
print ( 'Less than int64 min cast to int64 becomes int64 min:' , outOfRangeLoToInt64 );
Configurazione di Python
Consulta la pagina
Ambiente Python per informazioni sull'API Python e sull'utilizzo di
geemap
per lo sviluppo interattivo.
import ee
import geemap.core as geemap
Colab (Python)
# Cast a number to signed 64-bit integer:
# [-9223372036854775808, 9223372036854775808].
number = ee . Number ( 100 )
print ( 'Number:' , number . getInfo ())
int64_number = number . toInt64 ()
print ( 'Number cast to int64:' , int64_number . getInfo ())
"""Casting numbers to int64 that are outside of its range and precision can
modify the resulting value, note the behavior of the following scenarios.
"""
# A floating point number cast to int64 loses decimal precision.
float_number = ee . Number ( 1.7 )
print ( 'Floating point value:' , float_number . getInfo ())
float_to_int64 = float_number . toInt64 ()
print ( 'Floating point value cast to int64:' , float_to_int64 . getInfo ())
# A number greater than int64 range max becomes int64 range max.
# Python int is too large to be mapped to int64, use float instead.
INT64_MAX = 9223372036854775808.0
out_of_range_hi = ee . Number ( INT64_MAX + 12345 )
print ( 'Greater than int64 max:' , ' {:.0f} ' . format ( out_of_range_hi . getInfo ()))
out_of_range_hi_to_int64 = out_of_range_hi . toInt64 ()
print ( 'Greater than int64 max cast to int64 becomes int64 max:' ,
' {:.0f} ' . format ( out_of_range_hi_to_int64 . getInfo ()))
# A number greater than int64 range min becomes int64 range min.
# Python int is too large to be mapped to int64, use float instead.
INT64_MIN = - 9223372036854775808.0
out_of_range_lo = ee . Number ( INT64_MIN - 12345 )
print ( 'Less than int64 min:' , ' {:.0f} ' . format ( out_of_range_lo . getInfo ()))
out_of_range_lo_to_int64 = out_of_range_lo . toInt64 ()
print ( 'Less than int64 min cast to int64 becomes int64 min:' ,
' {:.0f} ' . format ( out_of_range_lo_to_int64 . getInfo ()))
Invia feedback
Salvo quando diversamente specificato, i contenuti di questa pagina sono concessi in base alla licenza Creative Commons Attribution 4.0 , mentre gli esempi di codice sono concessi in base alla licenza Apache 2.0 . Per ulteriori dettagli, consulta le norme del sito di Google Developers . Java è un marchio registrato di Oracle e/o delle sue consociate.
Ultimo aggiornamento 2025-07-26 UTC.
Vuoi dirci altro?
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Mancano le informazioni di cui ho bisogno","missingTheInformationINeed","thumb-down"],["Troppo complicato/troppi passaggi","tooComplicatedTooManySteps","thumb-down"],["Obsoleti","outOfDate","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Problema relativo a esempi/codice","samplesCodeIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 2025-07-26 UTC."],[],[]]