Skip to content

Commit

Permalink
feat(ban): add country to BAN's parsed response
Browse files Browse the repository at this point in the history
  • Loading branch information
p-j committed Feb 10, 2022
1 parent 123a202 commit 56a3d7d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/quick-impalas-cover.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@p-j/geocodejson-ban': minor
---

Add `geocoding.country` to BAN's parsed response
4 changes: 4 additions & 0 deletions packages/geocodejson-ban/src/geocodejson-ban.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ describe('@p-j/geocodejson-ban', () => {
score: 0.7592313152804641,
street: 'Rue du Général Leclerc',
type: 'housenumber',
country: 'France',
x: 635728.07,
y: 6855842.44,
},
Expand Down Expand Up @@ -80,6 +81,7 @@ describe('@p-j/geocodejson-ban', () => {
label: 'Place de la République 75011 Paris',
name: 'Place de la République',
postcode: '75011',
country: 'France',
score: 0.9670254545454545,
type: 'street',
x: 653452.35,
Expand Down Expand Up @@ -120,6 +122,7 @@ describe('@p-j/geocodejson-ban', () => {
name: 'Paris',
population: 2190327,
postcode: '75001',
country: 'France',
score: 0.9704590909090908,
type: 'municipality',
x: 652089.7,
Expand Down Expand Up @@ -158,6 +161,7 @@ describe('@p-j/geocodejson-ban', () => {
label: 'Pré Rura 05240 La Salle-les-Alpes',
name: 'Pré Rura',
postcode: '05240',
country: 'France',
score: 0.9387145454545454,
type: 'locality',
x: 981275.7,
Expand Down
1 change: 1 addition & 0 deletions packages/geocodejson-ban/src/geocodejson-ban.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ export function parseResult(result: BANGeocodeResponse['features'][number]): Geo
properties: {
geocoding: {
...properties,
country: 'France', // BAN covers France only and this field isn't returned by the original response
confidence: properties.score,
geohash: geohash.encode(result.geometry.coordinates[1], result.geometry.coordinates[0]),
},
Expand Down

0 comments on commit 56a3d7d

Please sign in to comment.