GeoCode locator not working properly for POI or Business

844
1
06-19-2017 05:52 PM
arunepuri1
New Contributor III

Hi All,

 

We are using ArcGIS Javascript API V 3.4 with "esri/tasks/locator", "esri/tasks/AddressCandidate",

 

When searched with Business names(Startbuck, San Francico or Walmart San Ramon) the suggestion are coming properly with magickey and bound the dataset to Grid

 

But when selected a row in the data grid, for user required address. The address locator not giving proper lat, longs.

 

GeoCode locator URL: http://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer 

 

Javascrpt Code snippet.

 

//Passing the one the suggestion address to get the lat,long

var newaddress = {
singleLine: item.address,
magicKey: item.Magickey
};
esrilocator.outSpatialReference = map.spatialReference;
esrilocator.addressToLocations(newaddress);
esrilocator.on("address-to-locations-complete", function (e) {

//Zoonto result lat,long

 

Checked direct URL which ESRI using  http://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/findAddressCandidates?SingleLine=... 

This also not working properly.

 

Anyonce faced the similar issue with esrilocator.addressToLocations

 

Please let me know your thoughts and suggestions

Tags (2)
0 Kudos
1 Reply
arunepuri1
New Contributor III

The issue fixed

the reason was passing the parameters in proper order/Passing address as object

//Error code

var newaddress = {
singleLine: item.address,
magicKey: item.Magickey
};

esrilocator.outSpatialReference = map.spatialReference;
esrilocator.addressToLocations(newaddress);

l.

//Working code

var address = { "singleLine": item.address };
var newaddress = { address: address, magicKey: item.Magickey };

esrilocator.outSpatialReference = map.spatialReference;
esrilocator.addressToLocations(newaddress);

0 Kudos