MCPcopy
hub / github.com/google/earthengine-api / getMapId

Function getMapId

python/ee/data.py:639–714  ·  view source on GitHub ↗

Get a Map ID for a given asset. Args: params: An object containing visualization options with the following possible values: image - The image to render, as an Image or a JSON string. The JSON string format is deprecated. version - (number) Version number of

(params: dict[str, Any])

Source from the content-addressed store, hash-verified

637
638
639def getMapId(params: dict[str, Any]) -> dict[str, Any]:
640 """Get a Map ID for a given asset.
641
642 Args:
643 params: An object containing visualization options with the
644 following possible values:
645 image - The image to render, as an Image or a JSON string.
646 The JSON string format is deprecated.
647 version - (number) Version number of image (or latest).
648 bands - (comma-separated strings) Comma-delimited list of
649 band names to be mapped to RGB.
650 min - (comma-separated numbers) Value (or one per band)
651 to map onto 00.
652 max - (comma-separated numbers) Value (or one per band)
653 to map onto FF.
654 gain - (comma-separated numbers) Gain (or one per band)
655 to map onto 00-FF.
656 bias - (comma-separated numbers) Offset (or one per band)
657 to map onto 00-FF.
658 gamma - (comma-separated numbers) Gamma correction
659 factor (or one per band).
660 palette - (comma-separated strings) A string of comma-separated
661 CSS-style color strings (single-band previews only). For example,
662 'FF0000,000000'.
663 format - (string) The desired map tile image format. If omitted, one is
664 chosen automatically. Can be 'jpg' (does not support transparency)
665 or 'png' (supports transparency).
666
667 Returns:
668 A map ID dictionary containing:
669 - "mapid" and optional "token" strings: these identify the map.
670 - "tile_fetcher": a TileFetcher which can be used to fetch the tile
671 images, or to get a format for the tile URLs.
672 """
673 if isinstance(params['image'], str):
674 raise ee_exception.EEException('Image as JSON string not supported.')
675 if 'version' in params:
676 raise ee_exception.EEException(
677 'Image version specification not supported.')
678 request = {
679 'expression':
680 serializer.encode(params['image'], for_cloud_api=True),
681 'fileFormat':
682 _cloud_api_utils.convert_to_image_file_format(params.get('format')),
683 'bandIds':
684 _cloud_api_utils.convert_to_band_list(params.get('bands')),
685 }
686 # Only add visualizationOptions to the request if it's non-empty, as
687 # specifying it affects server behaviour.
688 visualizationOptions = _cloud_api_utils.convert_to_visualization_options(
689 params)
690 if visualizationOptions:
691 request['visualizationOptions'] = visualizationOptions
692 # Returns only the `name` field, otherwise it echoes the entire request, which
693 # might be large.
694 queryParams = {
695 'fields': 'name',
696 'body': request,

Callers

nothing calls this directly

Calls 10

_execute_cloud_callFunction · 0.85
_get_cloud_projectsFunction · 0.85
_get_projects_pathFunction · 0.85
_get_stateFunction · 0.85
mapsMethod · 0.80
TileFetcherClass · 0.70
encodeMethod · 0.45
getMethod · 0.45
createMethod · 0.45

Tested by

no test coverage detected