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
Solved! Go to Solution.
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();
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();
Robert,
Perfect!
Thanks so much.
Tyler