Hi
I would like to create a search widget which only searches by suburb/ neighborhood.
Thus, only suburb names are provided as suggestions in the search.
I think that this might require some configuration in sources. However, I cannot find the solution.
Thanks in advance
Solved! Go to Solution.
Yes, Neighborhood is there in the Address Fields, but that is for multiline input, and that doesn't mean you can search on them from the Search widget. There are 2 input types for geocoding: multiline and singleline. The Search widget only uses singleline, and suggestions only work with singleline anyway.
For this to work with the Search widget, you would need to publish or configure a custom locator service. I would suggest that you use the Create Locator tool in ArcGIS Pro with the “Neighborhood” role. Here is more information on that process:
https://pro.arcgis.com/en/pro-app/latest/help/data/geocoding/introduction-to-custom-locators.htm
You could also use the locator class and build your own UI, instead of using the Search widget. Here is a tutorial that walks you through the basics:
https://developers.arcgis.com/javascript/latest/find-places/
Unfortunately, I think these are your available options. There might be a clever way to overwrite the getResults() and getSuggestions() methods, but I don't know for sure if this would work.
You would need to publish a Locator service specific for what you need.
Rene is correct. Also, here are a couple of samples that might provide inspiration:
https://developers.arcgis.com/javascript/latest/sample-code/widgets-search-multiplesource/
https://developers.arcgis.com/javascript/latest/sample-code/widgets-search-customsource/
Hi thanks for the responses @ReneRubalcava @@Noah-Sager
By this do you mean a Geocode Server that only contains suburbs?
The geocode server that I use contains all address information, including suburb (neighborhood)
I just need to find some way of querying only Suburb data:
Any ideas how to do this?
Thanks
Yes, Neighborhood is there in the Address Fields, but that is for multiline input, and that doesn't mean you can search on them from the Search widget. There are 2 input types for geocoding: multiline and singleline. The Search widget only uses singleline, and suggestions only work with singleline anyway.
For this to work with the Search widget, you would need to publish or configure a custom locator service. I would suggest that you use the Create Locator tool in ArcGIS Pro with the “Neighborhood” role. Here is more information on that process:
https://pro.arcgis.com/en/pro-app/latest/help/data/geocoding/introduction-to-custom-locators.htm
You could also use the locator class and build your own UI, instead of using the Search widget. Here is a tutorial that walks you through the basics:
https://developers.arcgis.com/javascript/latest/find-places/
Unfortunately, I think these are your available options. There might be a clever way to overwrite the getResults() and getSuggestions() methods, but I don't know for sure if this would work.
Thanks for the detailed and clear explanation @Noah-Sager. Appreciated. I will try to find some way of achieving what I need and provide updates here if I do succeed.