arcgis-rest-js
arcgis-rest-js copied to clipboard
SingleLine address - search addresses starting with
If I type into the search widget in google maps "23 Quee" and stop, the typeahead options are: 23 Queens Avenue, Mount Eden, Auckland 23 Queens Road, Panmure, Auckland 23 Queens Street, Northcoate, Auckland etc etc
If I send the same string "23 Quee" to the REST API with a country restriction of NZL - I get exactly one result (and its none of the above)
Its like the API is trying to match "23 Quee" as a full address rather than addresses that begin with this string.
Is there anyway to change this behavior or a begins with type option?
Thanks
Hi, thanks for the question.
Are you using suggest or geocode? I think based on your question you are probably working with suggest -- in this example I see 10 results: https://codepen.io/gavinr/pen/dyMOJKK?editors=0010

In addition to the documentation for arcgis-rest-js, you may want to review the REST API documentation for the suggest endopint. There are a variety of parameters you can send to get better results, including countryCode (which you're using), location, category, searchExtent.
Perfect thanks Gavin - suggest was exactly what I was looking for.
Also do you happen to know if you then GeoCode the selected result, and you are doing it for storage with a token, do you get a UID back?
How do you go about getting a token?
Thanks again
API Key help is here: https://developers.arcgis.com/arcgis-rest-js/authentication/tutorials/authenticate-with-an-api-key/