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])
| 715 | |
| 716 | |
| 717 | def 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 | |
| 757 | def _extract_table_converter(params: dict[str, Any]) -> Any | None: |
nothing calls this directly
no test coverage detected