mirror of
https://github.com/umap-project/umap.git
synced 2025-04-28 19:42:36 +02:00
wip: deal with boundary types in geodatamine importer
This commit is contained in:
parent
03ce8e90d6
commit
a7a214d7fe
1 changed files with 10 additions and 1 deletions
|
@ -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})`,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue