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

Function getFeatureViewTilesKey

python/ee/data.py:717–754  ·  view source on GitHub ↗

Get a tiles key for a given map or asset. Args: params: An object containing parameters with the following possible values: assetId - The asset ID for which to obtain a tiles key. visParams - The visualization parameters for this layer. Returns: A dictionary containing:

(params: dict[str, Any])

Source from the content-addressed store, hash-verified

715
716
717def getFeatureViewTilesKey(params: dict[str, Any]) -> dict[str, Any]:
718 """Get a tiles key for a given map or asset.
719
720 Args:
721 params: An object containing parameters with the following possible values:
722 assetId - The asset ID for which to obtain a tiles key.
723 visParams - The visualization parameters for this layer.
724
725 Returns:
726 A dictionary containing:
727 - "token" string: this identifies the FeatureView.
728 """
729 request = {
730 'asset':
731 _cloud_api_utils.convert_asset_id_to_asset_name(
732 params.get('assetId'))
733 }
734 # Only include visParams if it's non-empty.
735 if params.get('visParams'):
736 request['visualizationExpression'] = serializer.encode(
737 params.get('visParams'), for_cloud_api=True)
738 # Returns only the `name` field, otherwise it echoes the entire request, which
739 # might be large.
740 result = _execute_cloud_call(
741 _get_cloud_projects()
742 .featureView()
743 .create(parent=_get_projects_path(), fields='name', body=request)
744 )
745 name = result['name']
746 version = _cloud_api_utils.VERSION
747 format_tile_url = lambda x, y, z: (
748 f'{_get_state().tile_base_url}/{version}/{name}/tiles/{z}/{x}/{y}'
749 )
750 token = name.rsplit('/', 1).pop()
751 return {
752 'token': token,
753 'formatTileUrl': format_tile_url,
754 }
755
756
757def _extract_table_converter(params: dict[str, Any]) -> Any | None:

Callers

nothing calls this directly

Calls 8

_execute_cloud_callFunction · 0.85
_get_cloud_projectsFunction · 0.85
_get_projects_pathFunction · 0.85
_get_stateFunction · 0.85
featureViewMethod · 0.80
getMethod · 0.45
encodeMethod · 0.45
createMethod · 0.45

Tested by

no test coverage detected