I am replacing my GeoCoder Widget with Search Widget. In GeoCoder i can restrict my search in a certain area by doing this:
arcgisGeocoder: true,
arcgisGeocoder: {
placeholer: "Enter a US street address",
searchExtent: new esri.geometry.Extent({
xmin: -8631362.9367,
ymin: 4655884.590300001,
xmax: -8532954.2208,
ymax: 4772527.9208,
spatialReference: { "wkid": 102100 }
}),
url: "http://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer"
}
As i was looking into the search widget in JS 4.3, i could not find equivalent options. Any ideas of how to set such options in Search Widget?
Solved! Go to Solution.
Hemming,
You set the searchExtent on the Search widgets source array:
Hemming,
You set the searchExtent on the Search widgets source array:
Sometime you just have to be patient and read through the doc. Yes, the is a property for sources array.
Here is how i did and it worked.
this.geocoder = new Search({
container: "addrSearch",
autoSelect: false,
view: this.view,
searchAllEnabled: false,
sources: [
{
locator: new Locator("https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer"),
singleLineFieldName: "SingleLine",
outFields: ["Addr_type"],
name: "World GeoCoding Service",
minSuggestCharacters: 3,
autoNavigate: false,
popupEnabled: false,
searchExtent: Extent({
xmin: -8631362.9367,
ymin: 4655884.590300001,
xmax: -8532954.2208,
ymax: 4772527.9208,
spatialReference: { "wkid": 102100 }
}),
placeholder: "Enter a US street address",
resultSymbol:null,
}
]
});
Thanks Robert.