AnsweredAssumed Answered

Custom Locator w/ Search Dijit

Question asked by amoore4 on Nov 6, 2015
Latest reply on Nov 9, 2015 by evtguy

Hello, I am having trouble implementing a custom locator task to be a source inside my existing Search dijit.

 

I've built a US Addresses Single House Address Locator from our customer data as I am unable to access ESRI's World Geocoding service from inside the company network.

 

The Address locator works in ArcGIS Desktop when I try it out, but I can't seem to get it to work in my JS app. Can't find any help on the JS API reference or forums elsewhere on how exactly to get this working. This seems like a straightforward problem but it evades me. Either says no results found or just keeps spinning like it's searching, depending how I tweak it. Any help is appreciated!

 

require([
    "esri/map",
    "esri/dijit/Search",
    "esri/tasks/locator"
], function (
        Map,
        Search,
        Locator
) {

var map = new Map("mapDiv", {
        basemap: "streets",
        center: [-84.6, 38.9],
        zoom: 11,
        infoWindow: popup,
        sliderStyle: "large"
    });
    map.on("load", mapReady);

var s = new Search({
        sources: [],
        enableButtonMode: false,
        enableLabel: false,
        enableInfoWindow: true,
        showInfoWindowOnSelect: true,
        zoomScale: 10000,
        map: map
    }, "search");
    s.startup();

var locator = new Locator("http://MYSERVER.MYCOMPANY.com/ArcGIS/rest/services/INFORMATICA_SHAPE_WM_2_AddrLoc/GeocodeServer");

var sources = s.get("sources")
    sources.push({
        locator: locator,
        name: "Address Search",
        singleLineFieldName: "Single Line Input",
        placeholder: "Find address or place",
        minCharacters: 8,
        outFields: ["*"]
    });
s.set("sources", sources);

Outcomes