AnsweredAssumed Answered

Adding 2 Locators in source to Search Widget

Question asked by CSmith122_nysdot on Jul 10, 2018
Latest reply on Jul 11, 2018 by CSmith122_nysdot

Hi,

 

I am trying to add two Locators as sources to the Search Widget in the Arcgis Js 4.7 Api. However, only one of the Locators is working. Both of these Locators are publicly available by New York State. The Address and Street Locator is working, but the Place Locator will not work, meaning that if you type in a place in NYS, such as, "Albany, ny" or "latham, ny", the Place Locator will not find it. Is there some configuration that I am missing that will get both of these Locators to work? The Place Locator does work in other contexts, like in Web AppBuilder Apps, but not in ArcGis JS 4.x api. Here is my current code to add the Search Widget. Thanks in advance for your help!

 

let sources = [
{
singleLineFieldName: "SingleLine",
name: "NYS Place Locator",
localSearchOptions: {
minScale: 300000,
distance: 50000
},
placeholder: "Find Place",
exactMatch: false,
maxResults: 3,
maxSuggestions: 6,
suggestionsEnabled: true,
minSuggestCharacters: 0
},
{
singleLineFieldName: "SingleLine",
name: "NYS Address Locator",
localSearchOptions: {
minScale: 300000,
distance: 50000
},
placeholder: "Find Address",
maxResults: 3,
exactMatch: false,
maxSuggestions: 6,
suggestionsEnabled: true,
minSuggestCharacters: 0
}]

 

var searchWidget = new Search({
view: view,
sources: [],
suggestionsEnabled: true,

});

searchWidget.sources = sources;
view.ui.add(searchWidget, {
position: "top-right"
});

Outcomes