From a7a214d7fedb6f313ec065de627f85fbcdeccfef Mon Sep 17 00:00:00 2001 From: Yohan Boniface Date: Thu, 30 May 2024 17:33:03 +0200 Subject: [PATCH] wip: deal with boundary types in geodatamine importer --- umap/static/umap/js/modules/importers/geodatamine.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/umap/static/umap/js/modules/importers/geodatamine.js b/umap/static/umap/js/modules/importers/geodatamine.js index 9d2389bd..265f2f17 100644 --- a/umap/static/umap/js/modules/importers/geodatamine.js +++ b/umap/static/umap/js/modules/importers/geodatamine.js @@ -1,13 +1,22 @@ import { DomUtil } from '../../../vendors/leaflet/leaflet-src.esm.js' import { BaseAjax, SingleMixin } from '../autocomplete.js' +const BOUNDARY_TYPES = { + admin_6: 'département', + admin_7: 'pays (loi Voynet)', + admin_8: 'commune', + admin_9: 'quartier, hameau, arrondissement', + political: 'canton', + local_authority: 'EPCI', +} + class Autocomplete extends SingleMixin(BaseAjax) { URL = 'https://geodatamine.fr/boundaries/search?text={q}' createResult(item) { return super.createResult({ value: item.id, - label: `${item.name} (${item.ref})`, + label: `${item.name} (${BOUNDARY_TYPES[item.type]} — ${item.ref})`, }) } }