AnsweredAssumed Answered

esri tasks locator  - not returning any records for single address

Question asked by mravichandran on Feb 14, 2017
Latest reply on Feb 15, 2017 by mravichandran

dear Readers,

 

I followed the example mentioned for amd esri/tasks/locator as Locator.

var geocodeLocator = new Locator("https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer");

 

I created a function and the code inside the function was the following:

 

findAddress: function (streetAddress, countyFIPS, map) {

if (streetAddress.length === 0) {

alert('Please enter an address.');

return;

}

if (countyFIPS.length === 0) {

alert('County is needed.');

return; }

var searchAddress = { "Single Line Input": streetAddress }; // single element - not an array.

var options = {

address: searchAddress,

outFields: ["Loc_name"]};

geocodeLocator.outSpatialReference = map.spatialReference;

geocodeLocator.on("error", function (error) {

alert('Error code: [' + error.error.httpCode.toString() + '.] ' + error.error.message);

return;

});

geocodeLocator.on("address-to-locations-complete", function (addressCandidates) {

array.forEach(addressCandidates, function (eachAddressCandidate) {

var test = "";

console.log("results:" + results.toString());

});

});

geocodeLocator.addressToLocations(options);

 

}

 

{"spatialReference":{"wkid":102100,"latestWkid":3857},"candidates":[]}

getting an empty address candidates - let alone score . lat long...

 

any guidance will be greatly appreciated.

 

regards

ravi.

 

Outcomes