4.2 Locator addressToLocations error

1058
1
02-08-2017 10:21 AM
DerekLoi
New Contributor III

Hello,

I have a custom in-house Locator that accepts:

Address Fields:

  • Street ( type: esriFieldTypeString , alias: Street or Intersection , required: true , length: 60 )
  • Zone ( type: esriFieldTypeString , alias: Zone , required: false , length: 20 )

everything works fine in version 3.19

However, I keep getting an error in 4.2 

err.details:

               [Missing value for a required locator field 'Street or Intersection'.]

err.stack:  

Error: Unable to complete operation.
      at Anonymous function

(https://js.arcgis.com/4.2/:431:265)
      at f (https://js.arcgis.com/4.2/:117:491)
      at l (https://js.arcgis.com/4.2/:117:423)
      
at resolve

(https://js.arcgis.com/4.2/:120:86)
      at a (https://js.arcgis.com/4.2/:118:412)
      at f (https://js.arcgis.com/4.2/:118:169)
      at l (https://js.arcgis.com/4.2/:117:423)
      at resolve

(https://js.arcgis.com/4.2/:120:86)
      at a (https://js.arcgis.com/4.2/:118:412)
      at f (https://js.arcgis.com/4.2/:118:136)

here's the code that i'm using... following the 4.2 API

var address = { Street: '200 N Spring St', Zone: '90012' };   
var locator = new Locator();
    locator.url = '//myserver:6080/arcgis/rest/services/Locator/2011_Locator/GeocodeServer';
    locator.addressToLocations(address)
           .then(showAddressCandidates)
           .otherwise(rejectedPromise);

any help or insight into why this is happening would be greatly appreciated... its driving me nuts!

0 Kudos
1 Reply
DerekLoi
New Contributor III

so my issue was the javascript address object...

instead of this:

locator.addressToLocations(address)

 

It should be this:

locator.addressToLocations({ address: address})