Voici la documentation : https://geoplateforme.pages.gpf-tech.ign.fr/documentation

Skip to content
Extraits de code Groupes Projets

feat(reverse): IGNGPF-2605 Add two passes reverse geocoding

Fusionnées Jérôme Desboeufs a demandé de fusionner two-passes-reverse vers main
1 fichier
+ 12
1
Comparer les modifications
  • Côte à côte
  • En ligne
@@ -4,6 +4,9 @@ import circle from '@turf/circle'
import {bboxMaxLength, featureMatches, sortAndPickResults, extractIntersectingTiles} from './util.js'
const REVERSE_FIRST_PASS_CIRCLE_RADIUS_IN_METERS = 100
const REVERSE_SECOND_PASS_CIRCLE_RADIUS_IN_METERS = 200
export function reverse(options) {
const {rtreeIndex, formatResult, getFeatureByIdx, enableTileIndex} = options
@@ -31,7 +34,7 @@ export function reverse(options) {
}
if (!geometry) {
geometry = circle(center, 0.1, {step: 16})
geometry = circle(center, REVERSE_FIRST_PASS_CIRCLE_RADIUS_IN_METERS / 1000, {step: 16})
}
if (geometry.type === 'Circle') {
@@ -70,6 +73,14 @@ export function reverse(options) {
}
}
// In case we built a circle geometry and nothing is found, we try again with a larger circle
if (matchingFeatures.length === 0 && !options.geometry) {
return reverse({
...options,
geometry: circle(center, REVERSE_SECOND_PASS_CIRCLE_RADIUS_IN_METERS / 1000, {step: 16})
})
}
return sortAndPickResults(
matchingFeatures,
{limit, center}
Chargement en cours