Google Earth Engine website: https://earthengine.google.com/
JavaScript Code Editor: https://code.earthengine.google.com/
Documentation: https://developers.google.com/earth-engine/
Python API: https://developers.google.com/earth-engine/python_install
Author: Eduardo Ribeiro Lacerda - [email protected]
- Researcher @ Humboldt Universität zu Berlin
The Google Earth Engine Toolbox (GEET) is a JavaScript single-file library for help developers to write small code base application with the Google Earth Engine (GEE) plataform.
The library also can be used to teach new developers to use the plataform even without any previous programming skills.
GEET using Landsat collection 2 will be available soon!
All functions implemented (Version 0.7.7 - Beta):
svm
cart
rf
naive_bayes
max_ent
kmeans
ndvi_change_detection
ndwi_change_detection
ndbi_change_detection
texture
majority
color
plot_rgb
plot_ndvi
plot_ndwi
plot_class
landsat_indices
sentinel2_indices
load_image
collection2image
toa_radiance
toa_reflectance
toa_reflectance_l8
brightness_temp_l5k
brightness_temp_l5c
brightness_temp_l7k
brightness_temp_l7c
brightness_temp_l8k
brightness_temp_l8c
resample
resample_band
load_id_s2
build_annual_landsat_timeseries
landsat_timeseries_by_pathrow
landsat_timeseries_by_roi
ls5_timeseries_by_pathrow
ls7_timeseries_by_pathrow
ls8_timeseries_by_pathrow
mosaic_s2
mosaic_l5
mosaic_l7
mosaic_l8
modis_ndvi_mosaic
max
min
mean
median
mode
sd
variance
amplitude
spearmans_correlation
linear_fit
ndvi_l5
ndvi_l7
ndvi_l8
ndviS2
prop_veg
surface_emissivity
surface_temperature_tm
surface_temperature_oli
lst_calc_ls5
lst_calc_ls7
lst_calc_ls8
export_image
cloudmask
cloudmask_sr
fmask
pca
geom_filter
tasseledcap_oli
tasseledcap_tm5
tasseledcap_tm7
tasseledcap_s2
To use the library you need to click on this link. It will automatically add all the code of the library in your Google Earth Engine personal account. You only need to perform this procedure once. Remember that to add the library you must already have an account on the Earth Engine platform. To know more, visit the official site of the platform: https://earthengine.google.com/
After adding the library you can call its functions using the function require and storing the content in a variable. In this case, we will create a variable called geet which contains all the contents of the library. Then we can use it to call library functions:
var geet = require('users/eduardolacerdageo/geet:geet');
var image = geet.load_image('TOA', 2015); // Returns and loads an image on the map.
Para utilizar a biblioteca é preciso clicar neste link. Ele adicionará automaticamente todo o código da biblioteca na sua conta pessoal do Google Earth Engine. Só é necessário realizar este procedimento uma única vez. Lembre-se que para adicionar a biblioteca é necessário já possuir uma conta na plataforma do Earth Engine. Para saber mais, visite o site oficial da plataforma: https://earthengine.google.com/
Depois de adicionar a biblioteca é possível chamar suas funções utilizando a função require e armazenando o conteúdo em uma variável. Neste caso, criaremos uma variável chamada geet que contém todo o conteúdo da biblioteca. Depois, podemos utilizar ela para chamar as funções da biblioteca:
var geet = require('users/eduardolacerdageo/geet:geet');
var image = geet.load_image('TOA', 2015); // Retorna e carrega no mapa uma imagem.
(image, trainingData, fieldName, kernelType, resolution)
Function to apply SVM classification to a image.
(ee.Image) image - The input image to classify.
(FeatureCollection) trainingData - Training data (samples).
optional (string) fieldName - The name of the column that contains the class names.
optional (string) kernelType - the kernel type of the classifier.
optional (number) resolution - the spatial resolution of the input image. Default is 30 (landsat).
var imgClass = geet.svm(image, samplesfc, landcover);
(image, trainingData, fieldName, resolution)
Function to apply CART classification to a image.
(ee.Image) image - The input image to classify.
(FeatureCollection) trainingData - Training data (samples).
optional (string) fieldName - The name of the column that contains the class names.
optional (number) resolution - the spatial resolution of the input image. Default is 30 (landsat).
var imgClass = geet.cart(image, samplesfc, landcover);
(image, trainingData, fieldName, numOfTrees, resolution, cv_split)
Function to apply Random Forest classification to an image.
(ee.Image) image - The input image to classify.
(array of strings) bands - The input band names that will be choosed to train the model.
(FeatureCollection) trainingData - All the training data (samples).
(string) fieldName - The name of the column that contains the class names.
optional (number) numOfTrees - The number of trees that the model will create. Default is 10.
optional (number) resolution - the spatial resolution of the input image. Default is 30 (landsat).
optional (number) cv_split - The cross validation split percentage.
var imgClass = geet.rf(image, bands, samplesfc, landcover, 10);
or
var imgClass = geet.rf(image, bands, samplesfc, landcover, 10, 30, 0.7);
(image, trainingData, fieldName, resolution)
Function to apply the Fast Naive Bayes classification to a image.
(ee.Image) image - The input image to classify.
(FeatureCollection) trainingData - Training data (samples).
optional (string) fieldName - The name of the column that contains the class names.
optional (number) resolution - The spatial resolution of the input image. Default is 30 (landsat).
var imgClass = geet.naive_bayes(image, samplesfc, landcover);
or
var imgClass = geet.naive_bayes(image, samplesfc, landcover, 30);
(image, trainingData, fieldName, resolution)
Function to apply the GMO Maximum Entropy classification to a image.
(ee.Image) image - The input image to classify.
(FeatureCollection) trainingData - Training data (samples).
optional (string) fieldName - The name of the column that contains the class names.
optional (number) resolution - The spatial resolution of the input image. Default is 30 (landsat).
var imgClass = geet.gmo_max_ent(image, samplesfc, landcover);
or
var imgClass = geet.naive_bayes(image, samplesfc, landcover, 30);
(image, roi, numClusters, resolution, numPixels)
Function to apply RandomForest classification to an image.
(ee.Image) image - The input image to classify.
(Feature/Geometry) roi - A polygon containing the study area.
optional (number) _numClusters - the number of clusters that will be used. Default is 15.
optional (number) _scale - the scale number. The scale is related to the spatial resolution of the image. Landsat is 30, sou the default is 30 also.
optional (number) _numPixels - the number of pixels that the classifier will take samples from the roi.
var imgClass = geet.kmeans(image, roi);
or
var imgClass = geet.kmeans(image, roi, 20, 10, 6000);
(img1, img2, sensor, threshold)
Function to detect changes between two input images using the NDVI index and a threshold paramter. The function adds the two masked indices and return the sum of the two. Its a good choice to call the plot_class function to visualize the result. Ex: geet.plot_class(ndviChange, 3, 'change_detection');
(string) sensor = The name of the sensor that will be used. 'L5' or 'L8.
(ee.Image) img1 = The first input image.
(ee.Image) img2 = The second input image.
(ee.Number) threshold = The number of the threshold. All the values at the
image that is gte (grater of equal) to this number
will be selected.
var ndviChange = geet.simpleNDVIChangeDetection(image_2014, image_2015, 'L8', 0.5);
(img1, img2, sensor, threshold)
Function to detect changes between two input images using the NDWI index and a threshold paramter. The function adds the two masked indices and return the sum of the two. Its a good choice to call the plot_class function to visualize the result. Ex: geet.plot_class(ndwiChange, 3, 'change_detection');
(string) sensor = The name of the sensor that will be used. 'L5' or 'L8.
(ee.Image) img1 = The first input image.
(ee.Image) img2 = The second input image.
(ee.Number) threshold = The number of the threshold. All the values at the
image that is gte (grater of equal) to this number
will be selected.
var ndwiChange = geet.ndwi_change_detection( image_2014, image_2015, 'L8', 0.5);
(img1, img2, sensor, threshold)
Function to detect changes between two input images using the NDBI index and a threshold paramter. The function adds the two masked indices and return the sum of the two. Its a good choice to call the plot_class function to visualize the result. Ex: geet.plot_class(ndbiChange, 3, 'change_detection');
(string) sensor = The name of the sensor that will be used. 'L5' or 'L8.
(ee.Image) img1 = The first input image.
(ee.Image) img2 = The second input image.
(ee.Number) threshold = The number of the threshold. All the values at the
image that is gte (grater of equal) to this number
will be selected.
var ndbiChange = geet.ndbi_change_detection(image_2014, image_2015, 'L8', 0.5);
(image, radius)
Function generate a texture filter on the image.
(ee.Image) image = The input image.
(ee.Number) radius = the radius number that defines the effect level of the filter.
Bigger numbers generalize more the result.
var texture = geet.texture(image_from_rio, 1);
(image, radius)
Function to filter the final classification image and clear the salt n' pepper effect.
(ee.Image) image = The input image. (ee.Number) radius = the radius number that defines the effect level of the filter. Bigger numbers generalize more the result.
var majority = geet.majority(image_from_rio, 1);
(color)
Function to return a valid color value from the object COLOR.
(string) color - the name of the desired color. Valid options are water, forest, pasture, urban, shadow or null.
geet.color('water');
(image, title)
Function to plot a RGB image.
(ee.Image) image - the image to display.
optional (string) title - the layer title.
geet.plot_rgb(image, 'rgb_image');
(image, title)
Function to plot a NDVI image index.
(ee.Image) image - the image to display.
(string) title - the layer title.
geet.plot_ndvi(ndvi, 'ndvi_image');
(image, title)
Function to plot a NDWI image index.
(ee.Image) image - the image to display.
(string) title - the layer title.
geet.plot_ndwi(ndwi, 'ndwi_image');
(image, numClasses, title)
Function to plot the final classification map.
(ee.Image) image - the image to process.
(number) numClasses - the number of classes that your classification map has. It variates from 2 to 5 max classes only.
optional (string) title - the layer title.
geet.plot_class(classified, 4, 'class_final');
(image, sensor, index)
Function to take an input image and generate indexes like: NDVI, NDWI, NDBI...
More indices and features will be added in the future!
Supported indices: NDVI, NDWI, NDBI, NRVI, EVI, SAVI and GOSAVI
(ee.Image) image - the image to process.
(string) sensor - the sensor that you are working on Landsat 5 ('L5') 7 ('L7') and 8 ('L8').
optional (string or string array) index - you can specify the index that you want
if you dont specify any index the function will create all possible indices.
var result = geet.landsat_indices(image, 'L5'); // Will create all possible indices.
or specifying the index to generate:
var result = geet.landsat_indices(image, 'L5', 'savi'); // This will create only SAVI.
(image, index)
Function to take an input image and generate indexes using the Sentinel 2 dataset.
ndvi: Normalized Difference Vegetation Index
ndwi: Normalized Difference Water Index
ndbi: Normalized Difference Built-Up Index
mndwi: Modifed Normalized Difference Water Index
mndvi: Modified Normalized Difference Vegetation Index
ngrdi: Normalized Difference Green/Red Edge Index. (Aka VIgreen)
ndsi: Normalized Difference Salinity Index
ri: Redness Index
ndmi: Normalized Difference Moisture Index
gndvi: Green NDVI
bndvi: Coastal Blue NDVI
nbr: Normalized Burn Ratio
ppr: Plant Pigment Ratio
ndre: Normalized Difference Red Edge
lci: Leaf Chlorophyll Index
savi: Soil Adjusted Vegetation Index
gosavi: Green Optimized Soil Adjusted Vegetation Index
evi: Enhanced Vegetation Index
evi2: Enhanced Vegetation Index 2
gemi: Global Environmental Monitoring Index
rvi: Ratio Vegetation Index
logr: Log Ratio
tvi: Transformed Vegetation Index
(ee.Image) image - the image to process.
optional (string or string array) index - you can specify the index that you want
if you dont specify any index the function will create all possible indices.
var result = geet.sentinel2_indices(image); // Will create all possible indices.
or specifying the index to generate:
var result = geet.sentinel2_indices(image, 'savi'); // This will create only SAVI.
(collection, year, roi, cloudfree)
Function to get an example image to debug or test some code.
optional (string) collection - the type of the collection that will be filtered: RAW, TOA or SR.
optional (number) year - the year of the image that you want to get.
optional (list) roi - the latitude and longitude of a roi.
optional (bool) cloudFree - true for cloud mask processing and mean calculation.
var image = geet.load_image(); // Returns a TOA image
or
var image = geet.load_image('SR', 2015); // Returns a SR image
(image, previous)
Function to merge all imagens of one image collection into a single band.
(ee.Image) image - The image of the image collection to add as a band.
(ee.Image) previous - The output image.
var geet = require('users/eduardolacerdageo/geet:geet');
var merged_image = image_collection.iterate(geet.collection2image, ee.Image([]));
(image, band)
Function to do a band conversion of digital numbers (DN) to Top of Atmosphere (TOA) Radiance.
(ee.Image) image - The image to process.
(number) band - The number of the band that you want to process.
var new_toa_radiance = geet.toa_radiance(img, 10); // ee.Image
Formula: Lλ = MLQcal + AL
Lλ = TOA spectral radiance (Watts/( m2 * srad * μm))
ML = Band-specific multiplicative rescaling factor from the metadata (RADIANCE_MULT_BAND_x, where x is the band number)
AL = Band-specific additive rescaling factor from the metadata (RADIANCE_ADD_BAND_x, where x is the band number)
Qcal = Quantized and calibrated standard product pixel values (DN)
(image, band)
Function to do a band conversion of digital numbers (DN) to Top of Atmosphere (TOA) Reflectance.
(ee.Image) image - The image to process.
(number) band - The number of the band that you want to process.
var new_toa_reflectance = geet.toa_reflectance(img, 10); // ee.Image
Formula: ρλ' = MρQcal + Aρ
ρλ' = TOA planetary reflectance, without correction for solar angle. Note that ρλ' does not contain a correction for the sun angle.
Mρ = Band-specific multiplicative rescaling factor from the metadata (REFLECTANCE_MULT_BAND_x, where x is the band number)
Aρ = Band-specific additive rescaling factor from the metadata (REFLECTANCE_ADD_BAND_x, where x is the band number)
Qcal = Quantized and calibrated standard product pixel values (DN)
(image, band, solarAngle)
Function to do a band conversion of digital numbers (DN) to Top of Atmosphere (TOA) Reflectance Landsat 8 version with Solar Angle correction.
(ee.Image) image - The image to process.
(number) band - The number of the band that you want to process.
(string) solarAngle - The solar angle mode. 'SE' for local sun elevation angle and 'SZ' for local solar zenith angle.
var new_toa_reflectance_sz = geet.toa_reflectance_l8(img, 10, 'SZ'); // ee.Image
or
var new_toa_reflectance_se = geet.toa_reflectance_l8(img, 10, 'SE'); // ee.Image
Formula: ρλ' = MρQcal + Aρ
ρλ' = TOA planetary reflectance, without correction for solar angle. Note that ρλ' does not contain a correction for the sun angle.
Mρ = Band-specific multiplicative rescaling factor from the metadata (REFLECTANCE_MULT_BAND_x, where x is the band number)
Aρ = Band-specific additive rescaling factor from the metadata (REFLECTANCE_ADD_BAND_x, where x is the band number)
Qcal = Quantized and calibrated standard product pixel values (DN)
SE = Local sun elevation angle. The scene center sun elevation angle in degrees is provided in the metadata (SUN_ELEVATION).
SZ = Local solar zenith angle: SZ = 90° - SE
(image)
Function to do a band conversion of digital numbers (DN) to Top of Atmosphere (TOA) Reflectance.
(ee.Image) image - the Top of Atmosphere (TOA) image to convert.
var brightness_temp_img = geet.brightness_temp_l5k(toa_image); // ee.Image
T = Top of atmosphere brightness temperature (K)
Lλ = TOA spectral radiance (Watts/( m2 * srad * μm))
K1 = Band-specific thermal conversion constant from the metadata (K1_CONSTANT_BAND_x, where x is the thermal band number)
K2 = Band-specific thermal conversion constant from the metadata (K2_CONSTANT_BAND_x, where x is the thermal band number)
(image)
Function to convert the Top of Atmosphere image to Top of Atmosphere Brightness Temperature. This one works only for Landsat 5 data.
(ee.Image) image - the Top of Atmosphere (TOA) image to convert.
var brightness_temp_img = geet.brightness_temp_l5c(toa_image); // ee.Image
T = Top of atmosphere brightness temperature (K)
Lλ = TOA spectral radiance (Watts/( m2 * srad * μm))
K1 = Band-specific thermal conversion constant from the metadata (K1_CONSTANT_BAND_x, where x is the thermal band number)
K2 = Band-specific thermal conversion constant from the metadata (K2_CONSTANT_BAND_x, where x is the thermal band number)
(image)
Function to convert the Top of Atmosphere image to Top of Atmosphere Brightness Temperature. This one works only for Landsat 7 data.
(ee.Image) image - the Top of Atmosphere (TOA) image to convert.
var brightness_temp_img = geet.brightness_temp_l7k(toa_image); // ee.Image
T = Top of atmosphere brightness temperature (K)
Lλ = TOA spectral radiance (Watts/( m2 * srad * μm))
K1 = Band-specific thermal conversion constant from the metadata (K1_CONSTANT_BAND_x, where x is the thermal band number)
K2 = Band-specific thermal conversion constant from the metadata (K2_CONSTANT_BAND_x, where x is the thermal band number)
(image)
Function to convert the Top of Atmosphere image to Top of Atmosphere Brightness Temperature. This one works only for Landsat 7 data.
(ee.Image) image - the Top of Atmosphere (TOA) image to convert.
var brightness_temp_img = geet.brightness_temp_l7c(toa_image); // ee.Image
T = Top of atmosphere brightness temperature (K)
Lλ = TOA spectral radiance (Watts/( m2 * srad * μm))
K1 = Band-specific thermal conversion constant from the metadata (K1_CONSTANT_BAND_x, where x is the thermal band number)
K2 = Band-specific thermal conversion constant from the metadata (K2_CONSTANT_BAND_x, where x is the thermal band number)
(image, single)
Function to convert the Top of Atmosphere image to Top of Atmosphere Brightness Temperature. This one works only for Landsat 8 data.
(ee.Image) image - the Top of Atmosphere (TOA) image to convert.
(boolean) single - if false, will process only the B10 band, if true, will consider B11 too. Default its true!
var brightness_temp_img = geet.brightness_temp_l8k(toa_image); // ee.Image
or
var brightness_temp_img = geet.brightness_temp_l8k(toa_image, false); // ee.Image
T = Top of atmosphere brightness temperature (K)
Lλ = TOA spectral radiance (Watts/( m2 * srad * μm))
K1 = Band-specific thermal conversion constant from the metadata (K1_CONSTANT_BAND_x, where x is the thermal band number)
K2 = Band-specific thermal conversion constant from the metadata (K2_CONSTANT_BAND_x, where x is the thermal band number)
(image, single)
Function to convert the Top of Atmosphere image to Top of Atmosphere Brightness Temperature. This one works only for Landsat 8 data.
(ee.Image) image - the Top of Atmosphere (TOA) image to convert.
(boolean) single - if false, will process only the B10 band, if true, will consider B11 too. Default its true!
var brightness_temp_img = geet.brightness_temp_l8c(toa_image); // ee.Image
or
var brightness_temp_img = geet.brightness_temp_l8c(toa_image, false); // ee.Image
T = Top of atmosphere brightness temperature (K)
Lλ = TOA spectral radiance (Watts/( m2 * srad * μm))
K1 = Band-specific thermal conversion constant from the metadata (K1_CONSTANT_BAND_x, where x is the thermal band number)
K2 = Band-specific thermal conversion constant from the metadata (K2_CONSTANT_BAND_x, where x is the thermal band number)
(image, scale, mode)
Function to resample an input image.
(ee.Image) image - the image to resample.
(number) scale - the number of the spatial resolution that you
want to use to resample the input image.
(string) mode - The interpolation mode to use. One of 'bilinear' or 'bicubic'.
var landsat_10m = geet.resample(L8_img, 10, 'bilinear');
(band, scale, mode)
Function to resample just a single band.
(ee.Image) band - the band to resample.
(number) scale - the number of the spatial resolution that you
want to use to resample the input band.
(string) mode - The interpolation mode to use. One of 'bilinear' or 'bicubic'.
var landsatB10_60m = geet.resample_band(b10, 60, 'bicubic');
(id)
Function to filter the Sentinel-2 collection by Product ID obtained from the Copernicus Open Access Hub.
(string) id - the id of the Sentinel 2 image.
var s2_image = geet.load_id_s2('S2A_MSIL1C_20170512T093041_N0205_R136_T34TDN_20170512T093649');
(roi)
Function to build a annual Landsat surface reflectance timeseries from 1985 to 2017. The function also mask clouds and shadow and create some indices bands like NDVI, NDWI and SAVI.
(ee.Point) roi - the region of interest that will define the study area and the landsat path row
var ls_timeseries = geet.build_annual_landsat_timeseries(roi);
(type, path, row)
Function that return a image collection with all landsat images (5 and 8) from a defined path row. Remember to specify the type of the collection (raw, toa or sr).
(string) type - the type of the collection (RAW, TOA or SR)
(number) path - the path number of the image
(number) row - the row number of the image
var ls_collection = geet.landsat_timeseries_by_pathrow('SR', 217, 76);
(type, path, row)
Function that return a image collection with all landsat images (5 and 8) from a defined roi. Remember to specify the type of the collection (raw, toa or sr).
(string) type - the type of the collection (RAW, TOA or SR)
(ee.Geometry) roi - the Region of Interest to filter the dataset
var ls_collection = geet.landsat_timeseries_by_roi('SR', roi);
(type, path, row)
Function that return a image collection with all landsat 5 images from a defined path row.
(string) type - the type of the collection (RAW, TOA or SR) (number) path - the path number of the image (number) row - the row number of the image
var ls_collection = geet.ls5_timeseries_by_pathrow('SR', 220, 77);
(type, path, row)
Function that return a image collection with all landsat 7 images from a defined path row.
(string) type - the type of the collection (RAW, TOA or SR) (number) path - the path number of the image (number) row - the row number of the image
var ls_collection = geet.ls7_timeseries_by_pathrow('SR', 220, 77);
(type, path, row)
Function that return a image collection with all landsat 8 images from a defined path row.
(string) type - the type of the collection (RAW, TOA or SR) (number) path - the path number of the image (number) row - the row number of the image
var ls_collection = geet.ls5_timeseries_by_pathrow('SR', 220, 77);
(startDate, endDate, roi, showMosaic)
Function to build a cloud free TOA mosaic using the Sentinel 2 dataset.
(string) startDate - the start date of the dataset.
(string) endDate - the end date of the dataset.
optional (ee.Geometry) roi - the Region of Interest to filter the dataset.
optional (bool) _showMosaic - set to false if you dont want to display the mosaic. Default is true.
var s2_mosaic = geet.mosaic_s2('2016-01-01', '2016-12-31'); // Display the final world mosaic.
or
var s2_mosaic = geet.mosaic_s2('2016-01-01', '2016-12-31', roi); // Display the final mosaic of the roi
or
var s2_mosaic = geet.mosaic_s2('2016-01-01', '2016-12-31', roi, false); // Doesnt display the mosaic
(startDate, endDate, roi, showMosaic)
Function to build a cloud free mosaic using the Landsat 5 dataset.
(ee.Date) startDate - the start date of the dataset.
(ee.Date) endDate - the end date of the dataset.
optional (ee.Geometry) roi - the Region of Interest to filter the dataset.
optional (bool) _showMosaic - set to false if you dont want to display the mosaic. Default is true.
var l5_mosaic = geet.mosaic_l5('2005-01-01', '2005-12-31'); // Display the final world mosaic.
or
var l5_mosaic = geet.mosaic_l5(start, finish, roi); // Display the final mosaic of the roi
or
var l5_mosaic = geet.mosaic_l5('2005-01-01', '2005-12-31', roi, false); // Doesnt display the mosaic
(startDate, endDate, roi, showMosaic)
Function to build a cloud free mosaic using the Landsat 7 dataset.
(ee.Date) startDate - the start date of the dataset.
(ee.Date) endDate - the end date of the dataset.
optional (ee.Geometry) roi - the Region of Interest to filter the dataset.
optional (bool) _showMosaic - set to false if you dont want to display the mosaic. Default is true.
var l7_mosaic = geet.mosaic_l7('2003-01-01', '2003-12-31'); // Display the final world mosaic.
or
var l7_mosaic = geet.mosaic_l7(start, finish, roi); // Display the final mosaic of the roi
or
var l7_mosaic = geet.mosaic_l7('2003-01-01', '2003-12-31', roi, false); // Doesnt display the mosaic
(startDate, endDate, roi, showMosaic)
Function to build a cloud free mosaic using the Landsat 8 dataset.
(ee.Date) startDate - the start date of the dataset.
(ee.Date) endDate - the end date of the dataset.
optional (ee.Geometry) roi - the Region of Interest to filter the dataset.
optional (bool) _showMosaic - set to false if you dont want to display the mosaic. Default is true.
var l8_mosaic = geet.mosaic_l8('2015-01-01', '2015-12-31'); // Display the final world mosaic.
or
var l8_mosaic = geet.mosaic_l8(start, finish, roi); // Display the final mosaic of the roi
or
var l8_mosaic = geet.mosaic_l8('2015-01-01', '2015-12-31', roi, false); // Doesnt display the mosaic
(startDate, endDate, roi, showMosaic)
Function to build a cloud free NDVI mosaic using the MODIS/MOD13Q1 dataset.
(ee.Date) startDate - the start date of the dataset.
(ee.Date) endDate - the end date of the dataset.
optional (ee.Geometry) roi - the Region of Interest to filter the dataset.
optional (bool) _showMosaic - set to false if you dont want to display the mosaic. Default is true.
var modis_ndvi_mosaic = geet.modis_ndvi_mosaic('2015-01-01', '2015-12-31'); // Display the final world mosaic.
or
var modis_ndvi_mosaic = geet.modis_ndvi_mosaic(start, finish, roi); // Display the final mosaic of the roi
or
var modis_ndvi_mosaic = geet.modis_ndvi_mosaic('2015-01-01', '2015-12-31', roi, false); // Doesnt display the mosaic
(image, roi, scale, maxPixels)
Function the get the maximum value from an image and returns an dictionary with all band values.
(ee.Image) image - the input image.
optional (ee.Geometry) roi - the region of interest. Default is set to the image geometry.
optional (number) scale - the scale number.The scale is related to the spatial resolution of the image. Landsat is 30, so the default is 30 also.
optional (number) maxPixels - the number of maximun pixels that can be exported. Default is 1e10.
var img_max = geet.max(img);
or
var img_max = geet.max(img, roi, 30, 1e12);
(image, roi, scale, maxPixels)
Function the get the minimum value from an image and returns an dictionary with all band values.
(ee.Image) image - the input image.
optional (ee.Geometry) roi - the region of interest. Default is set to the image geometry.
optional (number) scale - the scale number.The scale is related to the spatial resolution of the image. Landsat is 30, so the default is 30 also.
optional (number) maxPixels - the number of maximun pixels that can be exported. Default is 1e10.
var img_min = geet.min(img);
or
var img_min = geet.min(img, roi, 30, 1e12);
(image, roi, scale, maxPixels)
Function the get the mean value from an image and returns a dictionary with all band values.
(ee.Image) image - the input image.
optional (ee.Geometry) roi - the region of interest. Default is set to the image geometry.
optional (ee.Number) scale - the scale number.The scale is related to the spatial resolution of the image. The default is 30.
optional (number) maxPixels - the number of maximun pixels that can be exported. Default is 1e10.
var mean = geet.mean(img);
or
var mean = geet.mean(img, roi, 30, 1e12);
(image, roi, scale, maxPixels)
Function the get the median value from an image and returns a dictionary with all band values.
(ee.Image) image - the input image.
optional (ee.Geometry) roi - the region of interest. Default is set to the image geometry.
optional (ee.Number) scale - the scale number.The scale is related to the spatial resolution of the image. The default is 30.
optional (number) maxPixels - the number of maximun pixels that can be exported. Default is 1e10.
var median = geet.median(img);
or
var median = geet.median(img, roi, 30, 1e12);
(image, roi, scale, maxPixels)
Function the get the mode value from an image and returns a dictionary with all band values.
(ee.Image) image - the input image.
optional (ee.Geometry) roi - the region of interest. Default is set to the image geometry.
optional (ee.Number) scale - the scale number.The scale is related to the spatial resolution of the image. The default is 30.
optional (number) maxPixels - the number of maximun pixels that can be exported. Default is 1e10.
var mode = geet.mode(img);
or
var mode = geet.mode(img, roi, 30, 1e12);
(image, roi, scale, maxPixels)
Function the get the standard deviation value from an image and returns a dictionary with all band values.
(ee.Image) image - the input image.
optional (ee.Geometry) roi - the region of interest. Default is set to the image geometry.
optional (ee.Number) scale - the scale number.The scale is related to the spatial resolution of the image. The default is 30.
optional (number) maxPixels - the number of maximun pixels that can be exported. Default is 1e10.
var standardDeviation = geet.sd(img);
or
var standardDeviation = geet.sd(img, roi, 30, 1e12);
(image, roi, scale, maxPixels)
Function the get the variance value from an image and returns a dictionary with all band values.
(ee.Image) image - the input image.
optional (ee.Geometry) roi - the region of interest. Default is set to the image geometry.
optional (ee.Number) scale - the scale number.The scale is related to the spatial resolution of the image. The default is 30.
optional (number) maxPixels - the number of maximun pixels that can be exported. Default is 1e10.
var variance = geet.variance(img);
or
var variance = geet.variance(img, roi, 30, 1e12);
(image, roi, scale, maxPixels)
Function the get the amplitude value from an image and returns a dictionary with all band values.
(ee.Image) image - the input image.
optional (ee.Geometry) roi - the region of interest. Default is set to the image geometry.
optional (ee.Number) scale - the scale number.The scale is related to the spatial resolution of the image. The default is 30.
optional (number) maxPixels - the number of maximun pixels that can be exported. Default is 1e10.
var amplitude = geet.amplitude(img);
or
var amplitude = geet.amplitude(img, roi, 30, 1e12);
(image, roi, scale, maxPixels)
Function the get the spearmans correlation value from an image and returns a dictionary with all band values.
(ee.Image) image1 - the first input image.
(ee.Image) image2 - the second input image.
(ee.Geometry) roi - the region of interest.
optional (ee.Number) scale - the scale number.The scale is related to the spatial resolution of the image. The default is 30.
optional (number) maxPixels - the number of maximun pixels that can be exported. Default is 1e10.
var spearmansCorrelation = geet.spearmans_correlation(img1, img2, roi);
or
var spearmansCorrelation = geet.spearmans_correlation(img1, img2, roi, 30, 1e12);
(image, roi, scale, maxPixels)
Function that computes the slope and offset for a (weighted) linear regression of 2 inputs. It returns a dictionary.
(ee.Image) image1 - the first input image.
(ee.Image) image2 - the second input image.
(ee.Geometry) roi - the region of interest.
optional (ee.Number) scale - the scale number.The scale is related to the spatial resolution of the image. The default is 30.
optional (number) maxPixels - the number of maximun pixels that can be exported. Default is 1e10.
var linearFit = geet.linear_fit(img1, img2, roi);
or
var linearFit = geet.linear_fit(img1, img2, roi, 30, 1e12);
(image)
Function calculate the normalized difference vegetation index (NDVI) from Landsat 5 data.
(ee.Image) image - the input image.
var l5_ndvi = geet.ndvi_l5(img);
(image)
Function calculate the normalized difference vegetation index (NDVI) from Landsat 7 data.
(ee.Image) image - the input image.
var l7_ndvi = geet.ndvi_l7(img);
(image)
Function calculate the normalized difference vegetation index (NDVI) from Landsat 8 data.
(ee.Image) image - the input image.
var l8_ndvi = geet.ndvi_l8(img);
(image)
Function calculate the normalized difference vegetation index (NDVI) from Sentinel 2 data.
(ee.Image) image - the input image.
var s2_ndvi = geet.ndviS2(img);
(image)
Function calculate the proportional vegetation.
(ee.Image) image - input image with the NDVI band.
var img_pv = geet.prop_veg(img);
(image)
Function calculate the surface emissifity.
(ee.Image) image - input image with the proportional vegetation band.
var lse = geet.surface_emissivity(pv);
(image)
Function calculate the land surface temperature (Landsat 5).
(ee.Image) image - the input image with the TOA_Radiance, Brightness_Temperature, NDVI, prop_veg and LSE bands.
var surfTemp_img = geet.surface_temperature_tm(img);
(image)
Function calculate the land surface temperature (Landsat 8).
(ee.Image) image - the input image with the TOA_Radiance, Brightness_Temperature, NDVI, prop_veg and LSE bands.
var surfTemp_img = geet.surface_temperature_oli(img);
(image)
Function calculate the land surface temperature from a Landsat 5 image doing all the process in a single function.
(ee.Image) image - the input Landsat 5 image.
var geet = require('users/eduardolacerdageo/geet:geet');
var lst = geet.lst_calc_ls5(img);
(image)
Function calculate the land surface temperature from a Landsat 7 image doing all the process in a single function.
(ee.Image) image - the input Landsat 7 image.
var geet = require('users/eduardolacerdageo/geet:geet');
var lst = geet.lst_calc_ls7(img);
(image)
Function calculate the land surface temperature from a Landsat 8 image doing all the process in a single function.
(ee.Image) image - the input Landsat 8 image.
var geet = require('users/eduardolacerdageo/geet:geet');
var lst = geet.lst_calc_ls8(img);
(image, scale)
Function to export an image to your Google Drive account.
(ee.Image) image - the input image.
optional (number) _scale - the scale number.The scale is related to the spatial resolution of the image. Landsat is 30, so the default is 30 also.
geet.export_image(img);
or
geet.export_image(sentinel2_img, 10);
(image)
Function create a cloud mask from a Landsat input image.
(ee.Image) image - the input image.
var cloudmask_img = geet.cloudmask(img);
(original_image, qa_image)
Function create a cloud mask from a Surface Reflectance Landsat input image.
(ee.Image) original_image - the original input image with all the bands.
(ee.Image) qa_band - the input QA band (pixel_qa band).
var img = images.first();
var QA = img.select(['pixel_qa']);
var masked_img = geet.cloudmask_sr(img, QA);
(original_image)
Function to cloud mask an Surface Reflectance Landsat input image.
(ee.Image) original_image - the original input image with all the bands.
var masked_img = geet.fmask(img);
PS: Special thanks to "HMSP": https://gis.stackexchange.com/users/93552/hmsp
(image, nbands, scale, maxPixels)
Function produce the principal components analysis of an image.
(ee.Image) image - the input image.
optional (number) nBands - the number of the bands of the image. Default is 12.
optional (number) scale - the scale number.The scale is related to the spatial resolution of the image. Landsat is 30, so the default is 30 also.
optional (number) maxPixels - the number of maximun pixels that can be exported. Default is 1e10.
var pca = geet.pca(img);
var pca_image = ee.Image(pca[0]);
Map.addLayer(pca_image);
Modified from https://github.com/mortcanty/earthengine/blob/master/src/eePca.py
(geom, column, symbol, value)
Function filter a geometry/feature by value.
(ee.Geometry) geom - the input geometry.
(string) column - the column name.
(string) symbol - the symbol. Ex: >, >=, <, <= or =.
(number) value - the value that will be used by the filter.
var geom_filtered = geet.geom_filter(geom, 'AreaSqKm', '>', 25000);
(image)
Function to create a Tasselled Cap using an Landsat 8 image.
(ee.Image) image - the input image.
var image_tcap = geet.tasseledcap_oli(img);
(image)
Function to create a Tasselled Cap using an Landsat 5 image.
(ee.Image) image - the input image.
var image_tcap = geet.tasseledcap_tm5(img);
(image)
Function to create a Tasselled Cap using an Landsat 7 image.
(ee.Image) image - the input image.
var image_tcap = geet.tasseledcap_tm7(img);
(image)
Function to create a Tasselled Cap on a Sentinel 2 image.
(ee.Image) image - the input image.
var image_tcap = geet.tasseledcap_s2(img);