Select to view content in your preferred language

Directions and Sources: Error when using world geocode service

2846
1
Jump to solution
06-01-2016 02:35 PM
DavidColey
Honored Contributor


Hi - I'm trying to use the world geocoder as my locator source in the Directions widget, along with a feature layer as a second source (3.16).  I've set up the sources array as such:

sources: [{
        locator: new Locator("https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer"),
        singleLineFieldName: "SingleLine",
        name: "Search by Address",
        localSearchOptions: {
            minScale: 300000,
            distance: 100
        },
        placeholder: "Search by Address",
        maxResults: 3,
        maxSuggestions: 3,
        enableSuggestions: true,
        minCharacters: 0,
  },
  {
       featureLayer: lyrBldg,
        searchFields: ["FACILITYNAME"],
        displayField: "FACILITYNAME",
        exactMatch: false,
        outFields: bldgFlds,
        name: "Search by Facility",
        localSearchOptions: {
            minScale: 300000,
            distance: 1000
        },
        placeholder: "Search for Facilities",
        maxResults: 3,
        maxSuggestions: 3,
        enableSuggestions: true,
        minCharacters: 0
  }],

but when entering an address (regardless whether the 'All' or 'Search by Address' search option is selected), the widget will place the stop A icon on map and then clear the address from the search input.  When entering a second address, the stop B icon is placed on the map, but again the input search box is cleared instantly.

As such, the icons remain on the map at their correct locations, but no route can be solved.

When using the world geocode service as the only source (i.e not in a sources array) I have no issues-

Suggestions?

Thanks,

David

0 Kudos
1 Solution

Accepted Solutions
DavidColey
Honored Contributor

Seems to be working today.  I probably needed to inlucde the outFields paramter in the soucces array:

outFields: ["Match_addr"],

View solution in original post

1 Reply
DavidColey
Honored Contributor

Seems to be working today.  I probably needed to inlucde the outFields paramter in the soucces array:

outFields: ["Match_addr"],