Retain input fields after locator.addressesToLocations

437
3
08-01-2023 10:54 AM
EricErtl
Regular Contributor

I am running the addressesToLocation (JavaScript Maps SDK v4.27) method in the locator class and I am hoping to return attributes that were in the original dataset.  In the returned AddressCandidates attributes response, the only fields that are returned are the geocoding result fields but no access to the original input fields (e.g., comments, alphanumeric uid, etc.)  Is there anyway to access these attributes so they can be accessed for use in a popup, etc.?

0 Kudos
3 Replies
BlakeTerhune
MVP Regular Contributor

locator | API Reference | ArcGIS Maps SDK for JavaScript 4.27 | ArcGIS Developers

Try specifying the outFields=* in the requestOptions of the params object.

0 Kudos
EricErtl
Regular Contributor

Thanks @BlakeTerhune for the reply.  I have tried using both the addressesToLocation (batch) and addressToLocation (single search) and it does not return the input fields (besides the address).  The outFields parameter is only available on the addressToLocation method.  I uploaded a csv with objectid, address, and comments for ~50 records but nothing in the response returns those fields (example output attributes object below).

{
    "Status": "M",
    "Score": 100,
    "Match_addr": "1420 McCarthy Blvd, New Bern, North Carolina, 28562",
    "LongLabel": "1420 McCarthy Blvd, New Bern, NC, 28562, USA",
    "ShortLabel": "1420 McCarthy Blvd",
    "Addr_type": "PointAddress",
    "Type": "",
    "PlaceName": "",
    "Place_addr": "1420 McCarthy Blvd, New Bern, North Carolina, 28562",
    "Phone": "",
    "URL": "",
    "Rank": 20,
    "AddBldg": "",
    "AddNum": "1420",
    "AddNumFrom": "",
    "AddNumTo": "",
    "AddRange": "",
    "Side": "",
    "StPreDir": "",
    "StPreType": "",
    "StName": "McCarthy",
    "StType": "Blvd",
    "StDir": "",
    "BldgType": "",
    "BldgName": "",
    "LevelType": "",
    "LevelName": "",
    "UnitType": "",
    "UnitName": "",
    "SubAddr": "",
    "StAddr": "1420 McCarthy Blvd",
    "Block": "",
    "Sector": "",
    "Nbrhd": "",
    "District": "",
    "City": "New Bern",
    "MetroArea": "",
    "Subregion": "Craven County",
    "Region": "North Carolina",
    "RegionAbbr": "NC",
    "Territory": "",
    "Zone": "",
    "Postal": "28562",
    "PostalExt": "2002",
    "Country": "USA",
    "LangCode": "ENG",
    "Distance": 0,
    "X": -77.09495801393672,
    "Y": 35.09757995227644,
    "DisplayX": -77.0941215,
    "DisplayY": 35.09773200000001,
    "Xmin": -77.0951215,
    "Xmax": -77.0931215,
    "Ymin": 35.09673200000001,
    "Ymax": 35.098732000000005,
    "ExInfo": ""
}

 

0 Kudos
AkshayKumar1
Emerging Contributor

Hi Eric,

I am too using JS 4.27 to geocode bunch of addresses via locator.addressesToLocations but promise is giving me the exception "<!DOCTYPE "... is not valid JSON`, need little bit of your help. I am using the following geocode service:

0 Kudos