In what's new section for version3.14 it is mentioned that direction widget can now use the custom geocoder/feature services as does the Search widget. There is no sample that I could find which shows this and API reference is not clear on how to set the serachOptions property of direction widget in order to achive this. I have tried setting the searchOptions property to both the search Widget and sources [] but it doesn't work. Can somebody please help!
Thanks
Solved! Go to Solution.
You should be able to set it like this:
var directions = new Directions({ searchOptions: {...}, map: map }, "dir"); directions.startup();
You should be able to set it like this:
var directions = new Directions({ searchOptions: {...}, map: map }, "dir"); directions.startup();
Thanks for quick reply. This worked.
In searchOptions, what is the content?
I set like this:)
<pre>
var searchOptions = {
locator: new Locator("http://pm2gcent6svr:6080/arcgis/rest/services/C_All_isj2015/GeocodeServer"),
singleLineFieldName: "SingleLine",
name: "Custom Geocoding Service",
localSearchOptions: {
minScale: 300000,
distance: 50000
},
placeholder: "Search Geocoder",
maxResults: 3,
maxSuggestions: 6,
enableSuggestions: true,
minCharacters: 0
};
</pre>
But directions object remain refering the default geocode site(geocode.arcgis.com).
How can I feed a custom feature geocoder/services ?
Thanks
It looks like that is one source. The searchOptions needs to be like this:
searchOptions: { sources: [ { locator: new Locator("http://pm2gcent6svr:6080/arcgis/rest/services/C_All_isj2015/GeocodeServer"), singleLineFieldName: "SingleLine", name: "Custom Geocoding Service", localSearchOptions: { minScale: 300000, distance: 50000 }, placeholder: "Search Geocoder", maxResults: 3, maxSuggestions: 6, enableSuggestions: true, minCharacters: 0 } ] }
Thanks for your reply. This worked fine!