28 lines
980 B
TypeScript
28 lines
980 B
TypeScript
import type { ThematicRasterSelectionResponse, VectorSelectionResponse } from '../types'
|
|
|
|
export function thematicRasterImageUrl(projectId: string, datasetId: string): string {
|
|
return `/api/v1/projects/${projectId}/datasets/${datasetId}/raster/thematic/image`
|
|
}
|
|
|
|
export function thematicRasterSelectionToMapSelection(result: ThematicRasterSelectionResponse): VectorSelectionResponse {
|
|
return {
|
|
selection_bbox: result.selection_bbox,
|
|
selection_area_id: result.selection_area_id,
|
|
feature_count: result.valid_cell_count,
|
|
total_feature_count: result.valid_cell_count,
|
|
limit: 0,
|
|
truncated: false,
|
|
geojson: { type: 'FeatureCollection', features: [] },
|
|
summary: {
|
|
...result.summary,
|
|
feature_count: result.valid_cell_count,
|
|
is_estimate: true,
|
|
warning: result.limitation_message,
|
|
metrics: result.summary.metrics.map((metric) => ({
|
|
...metric,
|
|
is_estimate: metric.is_estimate ?? true,
|
|
})),
|
|
},
|
|
}
|
|
}
|