f2

Missing parameter and other issues

Discussion created by f2 on Oct 6, 2011
This concerns the esri.tasks.Locator class of the javascript API.

locationToAddress(location, distance, callback?, errback?)
addressToLocations(address, outFields?, callback?, errback?)


Both methods return the type AddressCandidate. LocationToAddress returns one AddressCandidate and addressToLocations returns an array of AddressCandidate.

In the locationToAddress method the optional outFields parameter is missing. There is no reason why the programmer shouldn't be able to specify which fields he wants in the AddressCandidate object returned by locationToAddress.


As it is right now in order to retrieve additional field data one has to use the address provided by locationToAddress to call addressToLocations where outfields can be set.

When applying this to http://tasks.arcgisonline.com/ArcGIS/rest/services/Locators/TA_Address_EU/GeocodeServer another issue arises:

This is the definition for the Address Fields:

Address Fields:

    Address (Type: esriFieldTypeString, Alias: Address, Required: false )
    City (Type: esriFieldTypeString, Alias: City, Required: false )
    Postcode (Type: esriFieldTypeString, Alias: Postcode, Required: false )
    Country (Type: esriFieldTypeString, Alias: Country, Required: true )


For some reason the Country field is set to Required:true (there are no required fields in TA_Address_NA). The problem here is that there is no Country data available. locationToAddress only returns Address, City and Postcode data. Country is always null.

This means that retrieving an address and using addressToLocations to retrieve missing field data doesn't work because the country field is set to required. You have to manually set the country property to finally be able to access fields you define in outfields.


Finally I register an account to post a thread about this and I notice another irregularity. There are two URLs to register esri global accounts:

https://webaccounts.esri.com/cas/index.cfm/index.cfm
and
https://www.arcgis.com/home/createaccount.html

Notice that there are different policies for the format of username. (Also more required fields on the first link)

... please pay more attention to detail :rolleyes:

Outcomes