# GEET (Google Earth Engine Toolbox)
[![DOI](https://zenodo.org/badge/105400884.svg)](https://zenodo.org/badge/latestdoi/105400884)
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
#### Development Info
**Author**: Eduardo Ribeiro Lacerda - Associate Researcher @ IIS - International Institute for Sustainability / PhD Candidate @ UFF - Universidade Federal Fluminense (Brazil - Rio de Janeiro)
**Contact**: eduardolacerdageo@gmail.com
## Introduction:
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.
![ndvi](https://user-images.githubusercontent.com/7756611/28606761-031da9b8-71af-11e7-8e4a-3a716e8a9886.jpg)
## Documentation:
All functions implemented (Version 0.7.6 - Beta):
[svm](#svm)
[cart](#cart)
[rf](#rf)
[naive_bayes](#naive_bayes)
[max_ent](#gmo_max_ent)
[kmeans](#kmeans)
[ndvi_change_detection](#ndvi_change_detection)
[ndwi_change_detection](#ndwi_change_detection)
[ndbi_change_detection](#ndbi_change_detection)
[texture](#texture)
[majority](#majority)
[color](#color)
[plot_rgb](#plot_rgb)
[plot_ndvi](#plot_ndvi)
[plot_ndwi](#plot_ndwi)
[plot_class](#plot_class)
[landsat_indices](#landsat_indices)
[sentinel2_indices](#sentinel2_indices)
[load_image](#load_image)
[collection2image](#collection2image)
[toa_radiance](#toa_radiance)
[toa_reflectance](#toa_reflectance)
[toa_reflectance_l8](#toa_reflectance_l8)
[brightness_temp_l5k](#brightness_temp_l5k)
[brightness_temp_l5c](#brightness_temp_l5c)
[brightness_temp_l7k](#brightness_temp_l7k)
[brightness_temp_l7c](#brightness_temp_l7c)
[brightness_temp_l8k](#brightness_temp_l8k)
[brightness_temp_l8c](#brightness_temp_l8c)
[resample](#resample)
[resample_band](#resample_band)
[load_id_s2](#load_id_s2)
[build_annual_landsat_timeseries](#build_annual_landsat_timeseries)
[landsat_timeseries_by_pathrow](#landsat_timeseries_by_pathrow)
[landsat_timeseries_by_roi](#landsat_timeseries_by_roi)
[ls5_timeseries_by_pathrow](#ls5_timeseries_by_pathrow)
[ls7_timeseries_by_pathrow](#ls7_timeseries_by_pathrow)
[ls8_timeseries_by_pathrow](#ls8_timeseries_by_pathrow)
[mosaic_s2](#mosaic_s2)
[mosaic_l5](#mosaic_l5)
[mosaic_l7](#mosaic_l7)
[mosaic_l8](#mosaic_l8)
[modis_ndvi_mosaic](#modis_ndvi_mosaic)
[max](#max)
[min](#min)
[mean](#mean)
[median](#median)
[mode](#mode)
[sd](#sd)
[variance](#variance)
[amplitude](#amplitude)
[spearmans_correlation](#spearmans_correlation)
[linear_fit](#linear_fit)
[ndvi_l5](#ndvi_l5)
[ndvi_l7](#ndvi_l7)
[ndvi_l8](#ndvi_l8)
[ndviS2](#ndvis2)
[prop_veg](#prop_veg)
[surface_emissivity](#surface_emissivity)
[surface_temperature_tm](#surface_temperature_tm)
[surface_temperature_oli](#surface_temperature_oli)
[lst_calc_ls5](#lst_calc_ls5)
[lst_calc_ls7](#lst_calc_ls7)
[lst_calc_ls8](#lst_calc_ls8)
[export_image](#export_image)
[cloudmask](#cloudmask)
[cloudmask_sr](#cloudmask_sr)
[fmask](#fmask)
[pca](#pca)
[geom_filter](#geom_filter)
[tasseledcap_oli](#tasseledcap_oli)
[tasseledcap_tm5](#tasseledcap_tm5)
[tasseledcap_tm7](#tasseledcap_tm7)
[tasseledcap_s2](#tasseledcap_s2)
------------------------------------------------------------------------------
### Quickstart Guide:
### (English)
To use the library you need to click on this [link](https://code.earthengine.google.com/?accept_repo=users/elacerda/geet). 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:
```js
var geet = require('users/elacerda/geet:geet');
var image = geet.load_image('TOA', 2015); // Returns and loads an image on the map.
```
### (Português)
Para utilizar a biblioteca é preciso clicar neste [link](https://code.earthengine.google.com/?accept_repo=users/elacerda/geet). 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:
```js
var geet = require('users/elacerda/geet:geet');
var image = geet.load_image('TOA', 2015); // Retorna e carrega no mapa uma imagem.
```
------------------------------------------------------------------------------
### References:
#### svm
(image, trainingData, fieldName, kernelType, resolution)
_Function to apply SVM classification to a image._
##### Params:
(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).
##### Usage:
```js
var imgClass = geet.svm(image, samplesfc, landcover);
```
------------------------------------------------------------------------------
#### cart
(image, trainingData, fieldName, resolution)
_Function to apply CART classification to a image._
##### Params:
(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).
##### Usage:
```js
var imgClass = geet.cart(image, samplesfc, landcover);
```
------------------------------------------------------------------------------
#### rf
(image, trainingData, fieldName, numOfTrees, resolution, cv_split)
_Function to apply Random Forest classification to an image._
##### Params:
(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.
##### Usage:
```js
var imgClass = geet.rf(image, bands, samplesfc, landcover, 10);
```
or
```js
var imgClass = geet.rf(image, bands, samplesfc, landcover, 10, 30,