import type { TerrainSelectionResponse, VectorSelectionResponse } from '../types' export function terrainSelectionToMapSelection(result: TerrainSelectionResponse): VectorSelectionResponse { return { selection_bbox: result.selection_bbox, selection_area_id: result.selection_area_id, feature_count: 0, total_feature_count: 0, limit: 0, truncated: false, geojson: { type: 'FeatureCollection', features: [] }, summary: { ...result.summary, feature_count: result.sample_count, is_estimate: false, // A selection finer than one source cell was widened to the cells it // touches; the result then covers more ground than was drawn. warning: [result.cell_selection_warning, result.limitation_message].filter(Boolean).join(' '), selection_edge_warning: result.cell_selection_warning ?? null, metrics: result.summary.metrics.map((metric) => ({ ...metric, is_estimate: false, })), }, } }