Select to view content in your preferred language

How can I access the "additional fields" in a locator?

6466
14
Jump to solution
04-21-2015 04:55 PM
JaniceBaird
Frequent Contributor

When creating an Address Locator it is possible to map "Additional Field" to a field in your reference feature class. I have no issue doing this but am unable to figure out how to access this information when using the Address Locator. The help shows:

ArcGIS Help (10.2, 10.2.1, and 10.2.2) ...

Once I have published my Address Locator to arcgis server, how can I get to the PropertyOwner information when I use this address locator in arcgis javascript? I am able to geocode address and reverse geocode locations in my map but want to access the additional information.

I hope this makes sense...

Thanks,

Janice.

I am marking Chris with the correct answer since he pointed us in the direction of looking at the outfields. However, the information provided by Kelly and Tim is worth looking at! Thanks to all for helping me with this issue.

Tags (2)
0 Kudos
14 Replies
KellyHutchins
Esri Notable Contributor

All of the resulting out fields should be included if you specify the out fields when using the addressToLocations method. If I run this test app and look in the console I can see that the User_fld info is returned.

<!DOCTYPE html>
<html>
<head>
  <title>Create a Map</title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no">
  <link rel="stylesheet" href="http://js.arcgis.com/3.13/dijit/themes/claro/claro.css">
  <link rel="stylesheet" href="http://js.arcgis.com/3.13/esri/css/esri.css">
  <style>
    html, body, #mapDiv{
      padding: 0;
      margin: 0;
      height: 100%;
    }
  </style>
  
  <script src="http://js.arcgis.com/3.13/"></script>
  <script>
    require(["esri/map", "esri/tasks/locator", "dojo/_base/array", "dojo/domReady!"], function(Map, Locator,array) {




      var map = new Map("mapDiv", {
        center: [-56.049, 38.485],
        zoom: 3,
        basemap: "streets"
      });




      var locator = new Locator("http://www.skagitcounty.net/publicgis/rest/services/GeoCode/AddressLocator_Test2/GeocodeServer");


      var options = {
        address: {
          "Single Line Input": "910 CLEVELAND AVE, Mount Vernon, 98273"
        },
        outFields: ["*"]
      };
      locator.addressToLocations(options).then(function(results){
        array.forEach(results, function(result){
          if(result.attributes && result.attributes.User_fld){
            console.log(result.attributes.User_fld);
          }
        });


      });


    });
  </script>


</head>
<body class="claro">
  <div id="mapDiv"></div>
</body>
</html>
JaniceBaird
Frequent Contributor

Kelly,

I am doing reverse geocoding and using locationToAddress... Is there a way to get the field info from this? I suppose I could take the returned address and run it through addressToLocations. Would that be the best way to access the info or do you know of another way?

thanks,

Janice.

Who do I pick as "correct answer"? Chris was on the right trail with suggesting that I needed to add the outfields!

0 Kudos
KellyHutchins
Esri Notable Contributor

Do you have the coords for the location you are using? You might have to take the returned address and use addressesToLocations but I can take a look.

I'd pick Chris Smith as the correct answer since he was the first to reply with the info that you needed out fields.

0 Kudos
JaniceBaird
Frequent Contributor

I am using a map click to get the reverse geocoded address. I am using a locator like you show in your example only I am using locationToAddress. I should be able to feed this into the options for addressToLocations like in your example. I will try this unless you come up with a better method.

Thanks for your help!

0 Kudos
KellyHutchins
Esri Notable Contributor

I took a look and it doesn't look like reverse geocode will return the out fields so you'll have to feed the address back into addressToLocations.

0 Kudos