From 29d997827bc8472b5a1f3ea94dac305478c6fd24 Mon Sep 17 00:00:00 2001 From: Marion Date: Mon, 15 Jul 2024 08:04:18 +0200 Subject: [PATCH] WIP: a first very short look into the geocoding feature --- src/app/_services/map.service.ts | 7 +++++-- src/app/welcome/map/map.component.ts | 10 +++++----- src/assets/configs/config.json.tmpl | 2 +- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/app/_services/map.service.ts b/src/app/_services/map.service.ts index 8f59438..35b2ed6 100644 --- a/src/app/_services/map.service.ts +++ b/src/app/_services/map.service.ts @@ -286,10 +286,13 @@ export class MapService { return of([]); } const url = new URL(urlText); - url.searchParams.append('partitionlimit', '10'); - url.searchParams.append('query', inputText); + url.searchParams.append('format', 'geojson'); + url.searchParams.append('limit', '10'); + url.searchParams.append('countrycodes', 'CH'); + url.searchParams.append('q', inputText); return this.httpClient.get(url.toString()).pipe( map((featureCollectionData) => { + console.log(featureCollectionData); const featureCollection = this.geoJsonFormatter.readFeatures(featureCollectionData); if (coordinateResult) { featureCollection.push(coordinateResult); diff --git a/src/app/welcome/map/map.component.ts b/src/app/welcome/map/map.component.ts index 0df5db1..d6f1ac5 100644 --- a/src/app/welcome/map/map.component.ts +++ b/src/app/welcome/map/map.component.ts @@ -111,11 +111,11 @@ export class MapComponent implements OnInit { for (const feature of features) { const categoryId = feature.get('layer_name'); - if (this.configService.config?.geocoderLayers) { - if (this.configService.config.geocoderLayers.indexOf(categoryId) < 0) { - continue; - } - } + //if (this.configService.config?.geocoderLayers) { + // if (this.configService.config.geocoderLayers.indexOf(categoryId) < 0) { + // continue; + // } + // } let currentCategory = this.geocoderGroupOptions.find(x => x.id === categoryId); if (currentCategory) { diff --git a/src/assets/configs/config.json.tmpl b/src/assets/configs/config.json.tmpl index db61cf2..dc571bb 100644 --- a/src/assets/configs/config.json.tmpl +++ b/src/assets/configs/config.json.tmpl @@ -2,7 +2,7 @@ "apiUrl": "${API_BASE_URL}${ROOTURL}", "mediaUrl": "${MEDIA_URL}", "baseMapUrl": "https://wmts.geo.admin.ch/1.0.0/{layer}/{style}/current/{TileMatrixSet}/{TileMatrix}/{TileCol}/{TileRow}", - "geocoderUrl": "https://sitn.ne.ch/search", + "geocoderUrl": "https://nominatim.openstreetmap.org/search", "geocoderLayers": [ "adresses_sitn", "nom_local_lieu_dit", "search_cours_eau", "batiments_ofs", "axe_rue", "ImmeublesCanton", "communes", "cadastres",