feat: cache geojson data for vector files

This commit is contained in:
2026-07-01 17:40:25 +05:00
parent ec8a014e82
commit d5c291fb9b
6 changed files with 235 additions and 69 deletions

View File

@@ -304,11 +304,11 @@ func (h *DatasetHandler) get(w http.ResponseWriter, r *http.Request) {
httputil.WriteJSON(w, http.StatusOK, dataset)
}
// geojson returns the dataset as a GeoJSON FeatureCollection (RFC 7946). A
// vector_with_kato dataset always ignores its own geometry and instead joins the
// districts table on KATO code: one feature per KATO with the observation values
// mapped onto its district polygon. A plain vector dataset serves its own
// geometry as a single feature.
// geojson returns the dataset's pre-assembled GeoJSON FeatureCollection (RFC
// 7946), generated and stored at processing time. A vector_with_kato dataset's
// collection joins the districts table on KATO code (one feature per KATO with
// the observation values mapped onto its district polygon); a plain vector
// dataset's collection wraps its own geometry as a single feature.
func (h *DatasetHandler) geojson(w http.ResponseWriter, r *http.Request) {
id, ok := parseUUIDParam(w, r, "id")
if !ok {
@@ -321,7 +321,7 @@ func (h *DatasetHandler) geojson(w http.ResponseWriter, r *http.Request) {
}
w.Header().Set("Content-Type", "application/geo+json")
w.WriteHeader(http.StatusOK)
_ = json.NewEncoder(w).Encode(fc)
_, _ = w.Write(fc)
}
func (h *DatasetHandler) download(w http.ResponseWriter, r *http.Request) {