Select to view content in your preferred language

Adding 2 Locators in source to Search Widget

881
2
Jump to solution
07-10-2018 06:41 AM
deleted-user-bWhhezP4R-ec
Deactivated User

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"
});
0 Kudos
1 Solution

Accepted Solutions
SumitZ
by
Occasional Contributor

The single line field name is "SingleLineCityName" in the locator your are using, whereas you have configured it as "singleLine". 

Here is link using above configured locators with 4.x API sample

View solution in original post

2 Replies
SumitZ
by
Occasional Contributor

The single line field name is "SingleLineCityName" in the locator your are using, whereas you have configured it as "singleLine". 

Here is link using above configured locators with 4.x API sample

deleted-user-bWhhezP4R-ec
Deactivated User

Ah. I see where you found that in the service.

Thanks a lot for your help! I really appreciate it!

0 Kudos