Open geografa opened 1 month ago
When I attempt to send a request for some specific addresses, the response does not match the v6 API Playground results.
Example:
Expect: Same as playground.
Actual: The street number is dropped.
Code example:
const mbxGeocode = require("@mapbox/mapbox-sdk/services/geocoding-v6"); const geocodingClient = mbxGeocode({ accessToken: MAPBOX_ACCESS_TOKEN }); const fs = require("fs"); // add your address to this array in the same format as the example addresses const addresses = [ "464 Valley Brook Ave Lyndhurst NJ 07071", "12303 NE 130th Ln 520 Kirkland WA 98034", ]; function geocodeAddresses(addresses) { addresses.forEach((address) => { geocodingClient .forwardGeocode({ query: address, limit: 1, countries: ["US"], permanent: false, }) .send() .then((response) => { const results = response.body.features[0].id + ";" + response.body.features[0].properties.full_address + ";" + response.body.features[0].properties.coordinates.accuracy + ";" + response.body.features[0].properties.coordinates.longitude + ";" + response.body.features[0].properties.coordinates.latitude; console.log(results); }); }); } geocodeAddresses(addresses);
Do the request and params look correct?
I may have found the cause. If I remove the countries: ['US'], parameter, the response appears as expected. Still testing.
countries: ['US'],
It's possible this is a case issue. Should be countries: ['us'] (lowercase).
countries: ['us']
When I attempt to send a request for some specific addresses, the response does not match the v6 API Playground results.
Example:
Expect: Same as playground.
Actual: The street number is dropped.
Code example:
Do the request and params look correct?