arcgis-rest-js icon indicating copy to clipboard operation
arcgis-rest-js copied to clipboard

SingleLine address - search addresses starting with

Open bigalnz opened this issue 5 years ago • 2 comments

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

bigalnz avatar Aug 21 '20 11:08 bigalnz

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

image

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.

gavinr avatar Aug 21 '20 13:08 gavinr

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

bigalnz avatar Aug 21 '20 19:08 bigalnz

API Key help is here: https://developers.arcgis.com/arcgis-rest-js/authentication/tutorials/authenticate-with-an-api-key/

gavinr avatar Sep 20 '22 16:09 gavinr