AnsweredAssumed Answered

Geocoder Bug????

Question asked by GibbyAR on Oct 13, 2015
Latest reply on Oct 14, 2015 by schlot

so given the code snippet below, here's the behavior: When I "pick", with the mouse, the address offered by the autoComplete, the function "showResults" does not fire. However when I enter the same exact address and press Enter, the showResults function does fire. And.....after selecting a second address via pressing Enter, the following error message appears on the console: "Geocoder:: stop query" but after successfully finding and zooming to the address. This one has me baffled and it may just be code drunkedness. Thanks in advance, rGibson

 

 

<script src="http://js.arcgis.com/3.14/"></script>

    <script>

      var map;

      var geocoder;

      var locatorUrl = "http://gisapps.fortsmithar.gov/arcgis/rest/services/Locators/GISCREATOR_AddressPoints_CreateAddressL1/GeocodeServer";

      require([

        "esri/map", "esri/dijit/Geocoder", "dojo/domReady!"

      ], function(

        Map, Geocoder

      ) {

        map = new Map("map",{

          basemap: "topo",

          center: [-117.19,34.05], // lon, lat

          zoom: 13

        });

       

        var myGeocoders = [{

          url: locatorUrl,

          name: "myAddress",

   ////////very important when using custom geocoders

   singleLine: "Street"

   ////////

        }];

        geocoder = new Geocoder({

          map: map,

          autoComplete: true,

          arcgisGeocoder: false,

          geocoders: myGeocoders, 

          value: "8813 Meadow Dr"

        },"search");

        geocoder.startup();

 

 

        geocoder.on("find-results", showResults);

 

 

  function showResults(results) {

  var geom;               

            geom = results.results.results[0].feature.geometry; 

  alert(geom);           

  }   

 

 

      });

    </script>

Outcomes