Directions Dijit serachOptions

3636
5
Jump to solution
07-30-2015 02:02 PM
OmairChaudhry
New Contributor

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

0 Kudos
1 Solution

Accepted Solutions
MattDriscoll
Esri Contributor

You should be able to set it like this:






var directions = new Directions({
searchOptions: {...},
  map: map
}, "dir");
directions.startup();


View solution in original post

5 Replies
MattDriscoll
Esri Contributor

You should be able to set it like this:






var directions = new Directions({
searchOptions: {...},
  map: map
}, "dir");
directions.startup();


OmairChaudhry
New Contributor

Thanks for quick reply. This worked.

0 Kudos
by Anonymous User
Not applicable

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

0 Kudos
MattDriscoll
Esri Contributor

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
}
]
}
by Anonymous User
Not applicable

Thanks for your reply. This worked fine!

0 Kudos