feat: Add SLD endpoints, add date_to to vector_with_kato

This commit is contained in:
2026-08-01 22:09:59 +05:00
parent 00a0cd1b8e
commit 1e0844ca82
8 changed files with 656 additions and 34 deletions

View File

@@ -432,6 +432,54 @@ paths:
"400": { $ref: "#/components/responses/BadRequest" }
"404": { $ref: "#/components/responses/NotFound" }
/datasets/{id}/sld:
parameters:
- $ref: "#/components/parameters/IdParam"
post:
tags: [Datasets]
summary: Upload (or replace) a dataset's SLD style file
description: |
Multipart upload of an SLD (Styled Layer Descriptor) style file,
mirroring `POST /datasets`. Applies to every `file_type`. Uploading
again replaces the previously stored SLD.
Allowed extensions: `.sld`, `.xml`.
requestBody:
required: true
content:
multipart/form-data:
schema:
type: object
required: [file]
properties:
file:
type: string
format: binary
description: The SLD file.
responses:
"200":
description: SLD stored; the updated dataset
content:
application/json:
schema: { $ref: "#/components/schemas/Dataset" }
"400": { $ref: "#/components/responses/BadRequest" }
"404": { $ref: "#/components/responses/NotFound" }
"422": { $ref: "#/components/responses/ValidationError" }
get:
tags: [Datasets]
summary: Download a dataset's SLD style file
description: Returns 404 if no SLD has been uploaded for this dataset yet.
responses:
"200":
description: The SLD file stream
content:
application/xml:
schema:
type: string
format: binary
"400": { $ref: "#/components/responses/BadRequest" }
"404": { $ref: "#/components/responses/NotFound" }
/datasets/{id}/mapping:
parameters:
- $ref: "#/components/parameters/IdParam"
@@ -443,6 +491,10 @@ paths:
`ready`, to re-map). The KATO column and every mapped column must be among
the dataset's detected `attribute_columns`. Moves the dataset to
`extracting`; observations are produced asynchronously.
Each year column maps to either a single point in time (`date` only,
the original behavior) or a period (`date` and `date_to`, inclusive).
`date_to`, when present, must not be before `date`.
requestBody:
required: true
content:
@@ -672,6 +724,16 @@ components:
date:
type: string
format: date
description: >-
Point in time, or the start of the period when `date_to` is also
set.
date_to:
type: [string, "null"]
format: date
description: >-
Optional period end (inclusive), must not be before `date`. Omitted
or null means a single point in time (the original, pre-period
behavior).
GeoJSONGeometry:
type: [object, "null"]
@@ -699,6 +761,12 @@ components:
date (YYYY-MM-DD). For the single-feature case (dataset has its own
geometry) it holds only the observations, keyed by KATO code, each
mapping to its date->value pairs.
For a `vector_with_kato` dataset mapped with one or more period
year columns (`date_to` set), a sibling `periods` object is also
present, mapping each period's start date (the same key used in
`data`) to its end date. `periods` is omitted entirely when the
dataset has no period mappings.
additionalProperties: true
GeoJSONFeatureCollection:
@@ -769,6 +837,13 @@ components:
cog_storage_key:
type: [string, "null"]
description: Set for rasters once the Cloud-Optimized GeoTIFF is produced.
sld_storage_key:
type: [string, "null"]
description: Set once an SLD style file has been uploaded (any file_type).
sld_filename:
type: [string, "null"]
sld_content_type:
type: [string, "null"]
file_type:
$ref: "#/components/schemas/FileType"
size_bytes:
@@ -844,6 +919,12 @@ components:
date:
type: string
format: date
date_to:
type: [string, "null"]
format: date
description: >-
Period end (inclusive), carried over from the year mapping's
`date_to`. Null for a point-in-time observation.
value:
type: [number, "null"]
description: Numeric cell value, or null when non-numeric/empty.