Geocoding v6 not returning addresses like Playground
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 768
- Forks
- 191
- PR merge metrics
- No merged PRs in 30d
Description
When I attempt to send a request for some specific addresses, the response does not match the v6 API Playground results.
Example:
- 12303 NE 130th Ln 520 Kirkland WA 98034
- 464 Valley Brook Ave Lyndhurst NJ 07071
Expect:
Same as playground.
- [12303 NE 130th Ln 520 Kirkland WA 98034](https://docs.mapbox.com/playground/geocoding/?search_text=12303%20NE%20130th%20Ln%20520%20Kirkland%20WA%2098034&country=us&limit=3&types=address&access_token=pk.eyJ1IjoiZ3JhZmEiLCJhIjoiY2ptYjNtZWxnMDBrdDNwbnVicGJzOWg2NyJ9.9OulyCe3kEqMAXPbx1mKUA&searchType=forward)
- [464 Valley Brook Ave Lyndhurst NJ 07071](https://docs.mapbox.com/playground/geocoding/?search_text=464%20Valley%20Brook%20Ave%20Lyndhurst%20NJ%2007071&country=us&limit=3&types=address&access_token=pk.eyJ1IjoiZ3JhZmEiLCJhIjoiY2ptYjNtZWxnMDBrdDNwbnVicGJzOWg2NyJ9.9OulyCe3kEqMAXPbx1mKUA&searchType=forward)
Actual:
The street number is dropped.
- Northeast 130th Place, Kirkland, Washington 98034, United States;undefined;-122.163203;47.717499
- Valley Brook Ave, Clifton, New Jersey 07071, United States;undefined;-74.165226;40.862197
Code example:
```const MAPBOX_ACCESS_TOKEN = "";
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?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the provided geocoding-v6 forwardGeocode example and compare its query, countries, limit, and permanent parameters with the linked Playground requests. Reproduce both addresses and inspect the returned features; done means determining whether the SDK request is formed correctly and identifying whether the mismatch belongs in the SDK or the Geocoding API.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- api
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100