Using an external geocoder instead of ArcGIS World Geocoding Service

523
3
01-13-2021 04:59 AM
AndresKasekamp
New Contributor III

Is it possible to use the search widget with a different geocoder instead of the one suggested by Esri? I have an address search API, but I don't know whether is is supported?

Tags (3)
0 Kudos
3 Replies
BlakeTerhune
MVP Regular Contributor

Yes. I think geocode services are configured like normal with the sources property.

Noah-Sager
Esri Regular Contributor

Yes, the Search widget can work with the default Esri World Geocoder, with a layer, with a geocode service resource exposed by the ArcGIS Server REST API, or a properly configured 3rd party search API.

Search widget with a custom source (open data address search API for France)

https://developers.arcgis.com/javascript/latest/sample-code/widgets-search-customsource/index.html

Search widget with multiple sources (2 layers and Esri World Geocoder)

https://developers.arcgis.com/javascript/latest/sample-code/widgets-search-multiplesource/index.html

 

RyanBohan
Occasional Contributor II

Be sure to set the includedefaultsources to false

var searchWidget = new Search({
view: view,
allPlaceholder: "Search by street address",
autoSelect: true,
suggestionsEnabled: true,
includeDefaultSources: false,
sources: [
{
locator: new Locator({
//url: "https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer" //World GeocodeServer
url: "your GeocodeServer"
}),
name: "City Locator",
placeholder: "Street Address",
zoomScale: 1000
},
]
})

0 Kudos