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

what3words no longer working #332

Open
rogercreagh opened this issue Nov 3, 2021 · 0 comments
Open

what3words no longer working #332

rogercreagh opened this issue Nov 3, 2021 · 0 comments

Comments

@rogercreagh
Copy link

rogercreagh commented Nov 3, 2021

w3w api v2 is deprecated and returns an 403 error to the call for example
https://api.what3words.com//v2/forward?key=XXXXXX&addr=casino.galloping.pai

need to update to v3 api which would use for example
https://api.what3words.com/v3/autosuggest?key=XXXXXX&input=casino.galloping.pai

simply using the serviceUrl: https://api.what3words.com/v3/ option doesn't work as it is being generated as
https://api.what3words.com/v3/forward?key=XXXXXX&addr=casino.galloping.pai
which, not surprisingly gives a 404 error

there are also some useful additional options which could be passed for example
&language=en&focus=51.03,-2.90 to specify the language for the match and an approximate location, for example to give preference to partial matched nearest the current centre of the map

Simply changing what3words.ts:19 to specify 'v3' in place of 'v2'
and what3words.ts:29 to replace 'forward' with 'autosuggest'
and what3words.ts:32 to replace 'addr' with 'input'
would get the basic back on track I think.

actually looking at it I think it will be a bit more complex as the returned data is a json with the closest suggestions which probably has a different format to v2 api...
https://developer.what3words.com/public-api/docs#autosuggest

You might be better off implementing the simpler contvert-to-coordinates call as an alternative which requires the full 3 word address and you don't have to handle multiple suggestions
https://developer.what3words.com/public-api/docs#convert-to-coords

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

No branches or pull requests

1 participant