Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: the language options wasn't being passed to tomtom #13

Conversation

jgoizueta
Copy link

Acceptance:

Using this script (in cloud-native/lds-api/scripts):

import nodeGeocoder from 'node-geocoder'
import { NodeGeocoderOptions } from '@routes'

const language = 'en-US'
const address = 'Gutenbergstraße 36, 78549 Spaichingen, Germany'
const country: string | undefined = undefined
const limit = 2
const API_KEY = process.env.API_KEY

async function test () {
  const geocoder = nodeGeocoder({
    provider: 'tomtom',
    apiKey: API_KEY,
    country,
    limit,
    formatter: null,
    language
  } as NodeGeocoderOptions)
  const res = await geocoder.geocode(address)
  return res
}

test().then((res) => console.log(JSON.stringify(res, null, 2))).catch((err) => console.error('ERROR', err))

Result before: (note country is "Deutschland" even though we requested the answer in english)

[
  {
    "latitude": 48.06849,
    "longitude": 8.73147,
    "country": "Deutschland",
    "city": "Spaichingen",
    "state": "Baden-Württemberg",
    "streetName": "Gutenbergstraße",
    "streetNumber": "36",
    "countryCode": "DE",
    "matchConfidence": 1,
    "provider": "tomtom"
  }
]

After:

[
  {
    "latitude": 48.06849,
    "longitude": 8.73147,
    "country": "Germany",
    "city": "Spaichingen",
    "state": "Baden-Württemberg",
    "streetName": "Gutenbergstraße",
    "streetNumber": "36",
    "countryCode": "DE",
    "matchConfidence": 1,
    "provider": "tomtom"
  }
]

@jgoizueta jgoizueta merged commit 012591c into master Sep 13, 2024
4 checks passed
@jgoizueta jgoizueta deleted the bug/sc-439404/goodyear-missing-fields-and-error-with-language-language branch September 13, 2024 13:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants