geetools.batch.utils#

Missing docstring.

Module Contents#

Functions#

convertDataType(newtype)

Convert an image to the specified data type.

createAssets(asset_ids, asset_type, mk_parents)

Creates the specified assets if they do not exist.

create_asset(asset_id, asset_type[, mk_parents])

Create an Asset.

downloadFile(url, name, extension[, path])

Download a file from a given url.

getProjection(filename[, path])

Get EPSG from a shapefile using pycrs.

hasZ(pointlist)

Determine if points inside coordinates have Z values.

isPoint(pointlist)

Verify is a list is a list of points.

kmlToGeoJsonDict([kmlfile, data, encoding])

Convert a KML file to a GeoJSON dict.

matchDescription(name[, custom])

Format a name to be accepted as a description.

recrusiveDeleteAsset(assetId)

TODO missing docstring.

removeZ(coords)

Remove Z values from coordinates.

Attributes#

GEOMETRY_TYPES

geetools.batch.utils.convertDataType(newtype)[source]#

Convert an image to the specified data type.

Parameters:

newtype (str) – the data type. One of ‘float’, ‘int’, ‘byte’, ‘double’, ‘Uint8’,’int8’,’Uint16’, ‘int16’, ‘Uint32’,’int32’

Returns:

a function to map over a collection

Return type:

function

geetools.batch.utils.createAssets(asset_ids, asset_type, mk_parents)[source]#

Creates the specified assets if they do not exist.

This is a fork of the original function in ‘ee.data’ module with the difference that.

  • If the asset already exists but the type is different that the one we want, raise an error

  • Starts the creation of folders since ‘user/username/’

Will be here until I can pull requests to the original repo

Parameters:
  • asset_ids (list) – list of paths

  • asset_type (str) – the type of the assets. Options: “ImageCollection” or “Folder”

  • mk_parents (bool) – make the parents?

Returns:

A description of the saved asset, including a generated ID

geetools.batch.utils.create_asset(asset_id, asset_type, mk_parents=True)[source]#

Create an Asset.

geetools.batch.utils.downloadFile(url, name, extension, path=None)[source]#

Download a file from a given url.

Parameters:
  • url (str) – full url

  • name (str) – name for the file (can contain a path)

  • extension (str) – extension for the file

Returns:

the created file (closed)

Return type:

file

geetools.batch.utils.getProjection(filename, path=None)[source]#

Get EPSG from a shapefile using pycrs.

Parameters:

filename (str) – an ESRI shapefile (.shp)

geetools.batch.utils.hasZ(pointlist)[source]#

Determine if points inside coordinates have Z values.

geetools.batch.utils.isPoint(pointlist)[source]#

Verify is a list is a list of points.

geetools.batch.utils.kmlToGeoJsonDict(kmlfile=None, data=None, encoding=None)[source]#

Convert a KML file to a GeoJSON dict.

geetools.batch.utils.matchDescription(name, custom=None)[source]#

Format a name to be accepted as a description.

The rule is:

The description must contain only the following characters: a..z, A..Z, 0..9, “.”, “,”, “:”, “;”, “_” or “-”. The description must be at most 100 characters long.

geetools.batch.utils.recrusiveDeleteAsset(assetId)[source]#

TODO missing docstring.

geetools.batch.utils.removeZ(coords)[source]#

Remove Z values from coordinates.

geetools.batch.utils.GEOMETRY_TYPES[source]#