EarthEngineREST.jl API
EarthEngineREST Types
EarthEngineREST.EESession
— TypeEESession
type used for authenticating request to the API
project::AbstractString
GCP project name used for REST API requests
auth::PyCall.PyObject
authenticated Python requests session for making requests
EarthEngineREST.GridDimensions
— TypeType used for defining the number of rows and columns for image requests See https://developers.google.com/earth-engine/reference/rest/v1beta/PixelGrid#GridDimensions
width::Integer
width of the grid, in pixels
height::Integer
height of the grid, in pixels
EarthEngineREST.AffineTransform
— TypeType for defining the affine transform of image requests. The six values form a 2x3 matrix:
See https://developers.google.com/earth-engine/reference/rest/v1beta/PixelGrid#affinetransform
EarthEngineREST.PixelGrid
— TypeType used for defining a pixel grid on the surface of the Earth, via a map projection See https://developers.google.com/earth-engine/reference/rest/v1beta/PixelGrid
dimensions::GridDimensions
dimensions of the pixel grid
affineTransform::AffineTransform
affine transform of pixel grid
crsCode::AbstractString
standard coordinate reference system code (e.g. 'EPSG:4326')
Image Computations
EarthEngineREST.computepixels
— Functioncomputepixels(session::EESession, pixelgrid::PixelGrid, image::EE.AbstractEEObject; format::AbstractString = "NPY")
Function to take an EarthEngine computed image and return an Array with geographic information (i.e. GeoArray). This signature will return all of the bands within the image. Currently on the "NPY" format is available. See https://developers.google.com/earth-engine/reference/rest/v1beta/projects.image/computePixels
computepixels(session::EESession, pixelgrid::PixelGrid, image::EE.AbstractEEObject, bands::AbstractVector{String}; format::AbstractString = "NPY")
Function to take an EarthEngine computed image and return an Array with geographic information (i.e. GeoArray). Currently on the "NPY" format is available. See https://developers.google.com/earth-engine/reference/rest/v1beta/projects.image/computePixels
EarthEngineREST.parse_npy_header
— Functionparse_npy_header(hdr::AbstractString)
Function to parse npy header information to extract dimensions and array dtypes. Customized implementation of NPY.parseheader
to handle numpy structured arrays which EE always returns. See https://numpy.org/devdocs/reference/generated/numpy.lib.format.html#format-version-1-0 for spec.
EarthEngineREST.decode_npy_response
— Functiondecode_npy_response(response::PyObject)
Function to take a response object of a npy bytes and convert to Julia array
Table Computations
EarthEngineREST.computetable
— Functioncomputetable(session::EESession, featurecollection::EE.AbstractEEObject)
Fuction to request data from EarthEngine FeatureCollection and return as a GeoDataFrame. See https://developers.google.com/earth-engine/reference/rest/v1beta/projects.table/computeFeatures
Value Computations
EarthEngineREST.computevalue
— Functioncomputevalue(session::EESession, value::EE.AbstractEEObject)
Fuction to request data from any arbitrary EarthEngine computation and return as the appropriate Julia object. See https://developers.google.com/earth-engine/reference/rest/v1beta/projects.value/compute
EarthEngineREST internals
EarthEngine.Initialize
— FunctionInitialize(session::EESession)
Extends the Initialize()
function to take an authenticated Earth Engine session and use those credentials.
EarthEngineREST._sendrequest
— Function_sendrequest(session::EESession, endpoint::AbstractString, data::Dict{Symbol,<:Any}; version::AbstractString = "latest", nretries::Integer = 4)
Private function for sending requests to EarthEngine REST API. Uses exponential backoff to retry requests if failed with non-fatal error.
EarthEngineREST.typetodict
— Functiontypetodict(x::T)
Function to convert EarthEngineREST types to dictionary key,value pairs to encode for API requests
EarthEngineREST.extract_geotransform
— Functionextract_geotransform(x::AffineTransform)
Function to extract geotransform vector from AffineTransformation type
extract_geotransform(x::PixelGrid)
Function to extract geotransform vector from PixelGrid type
EarthEngineREST.extract_bbox
— Functionextract_bbox(x::AffineTransform, griddims::GridDimensions)
Function to extract bounding box vector from AffineTransform type. Vector will be [W, S, E, N]
extract_bbox(x::PixelGrid)
Function to extract bounding box vector from PixelGrid type. Vector will be [W, S, E, N]
EarthEngineREST.extract_affinemap
— Functionextract_affinemap(x::AffineTransform)
Function to extract AffineMap type from AffineTransform type.
extract_affinemap(x::PixelGrid)
Function to extract AffineMap type from PixelGrid type.
EarthEngineREST.extract_gridcoordinates
— Functionextract_gridcoordinates(x::PixelGrid)
Function to convert PixelGrid to vectors of lat lon coordinates. Returns a tuple of (lon::Vector{Float64}, lat::Vector{Float64}).