rocksolid311

Using Locate to geocode address

Discussion created by rocksolid311 on Jul 6, 2011
Latest reply on Jul 7, 2011 by rocksolid311
Hi,

I am trying to geocode an address using the locate task, and I keep getting the error "Address or Intersection must be specified"

As far as I can tell, I am using the correct model for the addressToLocations() functions.

Here is what I have:

function init() {
        locator = new esri.tasks.Locator("http://gis.hamiltoncounty.in.gov/ArcGIS/rest/services/Addresses/GeocodeServer");
  dojo.connect(locator, "onAddressToLocationsComplete");

function locate() {
  var add = dojo.byId("address").value.split(",");
  var address = {
    Street : add[0],
    City : add[1],
    State : add[2],
    Zip: add[3]
   };
  locator.addressToLocations(address, ["Loc_name"]);
      }
 
       dojo.addOnLoad(init);
    </SCRIPT>

</head>
  <body class="claro">
    Find Address by Location: <input type="text" id="address" size="40" value="1 Civic Sq, Carmel, IN, 46032" /> <i>(Street, City, State, Zip)</i>
    <input type="button" value="Locate" onclick="locate()" />
    <div id="tbl"></div>
  </body>
</html>

Outcomes