ArcGIS API for JavaScript Search Dijit Composite Geolocator Help

938
2
Jump to solution
02-23-2018 07:25 AM
by Anonymous User
Not applicable

Greetings, I am trying to add a composite GoecodeServer to the ESRI Online World geolocator in the JavaScript search Digit. I have pushed the geolocator into the search's sources like this:

search = new Search({
map: map
    , enableInfoWindow: false
    , showInfoWindowOnSelect: false
    , enableButtonMode: true
    , enableLabel: false
    , maxSuggestions: 4
    , enableHighlight: false
}, "search");
var sources = search.get("sources");
sources.push({
    //Pass in the custom locator to the sources
    locator: new     Locator("https://maps.townofcary.org/arcgis1/rest/services/Locators/Cary_Com_Locator/GeocodeServer"),
    singleLineFieldName: "SingleKey",
    outFields: ["Street"],
    name: "Composite",
    localSearchOptions: {
        minScale: 300000,
    distance: 50000
},
autoNavigate: true,
placeholder: "exemple: Place de la Riponne Lausanne 1005",
//highlightSymbol: new PictureMarkerSymbol("https://js.arcgis.com/3.17/esri/dijit/Search/images/search-pointer.png", 36, 36).setOffset(9, 18),
//Create an InfoTemplate
infoTemplate: new InfoTemplate("Address", "${Address}")
})
search.set("sources", sources);
search.graphicsLayer = mapPinLayer;
search.startup(); 

When I search for an address, the typeahead in the search digit provides results as expected from my composite geolocator (Attachment: Composite1.png). However when I select one of the results, I get a "No results" message in the search digit (Attachment: Composite2.png).  

Is there a trick to including composite geolocators in the search digit? Can anyone point me to an example of where they were able pull this off? 

Many thanks, 

Tyler 

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Tyler,

   Here is what I got working using your service.

Lines 16, 17 and 25 are the most important.

      search = new Search({
        map: map,
        enableInfoWindow: true,
        showInfoWindowOnSelect: true,
        enableButtonMode: true,
        enableLabel: false,
        maxSuggestions: 4,
        enableHighlight: true
      }, "search");

      var sources = search.get("sources");

      sources.push({
        //Pass in the custom locator to the sources
        locator: new Locator("https://maps.townofcary.org/arcgis1/rest/services/Locators/Cary_Com_Locator/GeocodeServer"),
        singleLineFieldName: "SingleLine",
        outFields: ["*"],
        name: "Composite",
        localSearchOptions: {
          minScale: 300000,
          distance: 50000
        },
        autoNavigate: true,
        placeholder: "exemple: Place de la Riponne Lausanne 1005",
        infoTemplate: new InfoTemplate("Address", "${Match_addr}")
      })
      search.set("sources", sources);
      //search.graphicsLayer = mapPinLayer;
      search.startup();

View solution in original post

2 Replies
RobertScheitlin__GISP
MVP Emeritus

Tyler,

   Here is what I got working using your service.

Lines 16, 17 and 25 are the most important.

      search = new Search({
        map: map,
        enableInfoWindow: true,
        showInfoWindowOnSelect: true,
        enableButtonMode: true,
        enableLabel: false,
        maxSuggestions: 4,
        enableHighlight: true
      }, "search");

      var sources = search.get("sources");

      sources.push({
        //Pass in the custom locator to the sources
        locator: new Locator("https://maps.townofcary.org/arcgis1/rest/services/Locators/Cary_Com_Locator/GeocodeServer"),
        singleLineFieldName: "SingleLine",
        outFields: ["*"],
        name: "Composite",
        localSearchOptions: {
          minScale: 300000,
          distance: 50000
        },
        autoNavigate: true,
        placeholder: "exemple: Place de la Riponne Lausanne 1005",
        infoTemplate: new InfoTemplate("Address", "${Match_addr}")
      })
      search.set("sources", sources);
      //search.graphicsLayer = mapPinLayer;
      search.startup();
by Anonymous User
Not applicable

Robert, 

Perfect!

Thanks so much. 

Tyler

0 Kudos