Geocoder custom service not working

3180
14
09-06-2013 11:01 AM
PLadd
by
Occasional Contributor III
I'm having trouble using my own geocoding service and hope someone can set me on the right path. 

I've looked at the ESRI sample and at the sample at the bottom of this page but am not able to insert my own geocoder custom service url and name and get it to work.

I ran it through jsfiddle but get no errors.  It just does nothing.  If it helps, my geocoding service is located here. and name is MeridenGeocoder.

Does my spatial reference matter?  My geocoder service is working against a street centerline that is CT stateplane, NAD83 feet (Spatial Reference: 102656  (2234) ).  Thanks for your consideration in this matter.
14 Replies
JohnGravois
Frequent Contributor
thanks for taking the time to share how you wired your event handler and passed the result point geometry in a call to map.centerAndZoom().  nice work!
0 Kudos
TammyBearly
New Contributor
I am still having trouble. If I start with a map scale that shows the state of Colorado, it executes the centerAndZoom call, zooms in, and it is blurry. If I start way zoomed in it keeps this level of zoom. I created a sandbox example at: http://ndis-staging.nrel.colostate.edu/debug/map/geocode2.html. I am using a drop down list with suggestions, so the find-results event does not work. Instead I am using the select event. Is this the correct event to use?

 var myGeocoders = [
     {
          url: "http://ndis-flex.nrel.colostate.edu/ArcGIS/rest/services/AddressLocator_All2/GeocodeServer",
          name: "AddressLocator_All2",
      placeholder: "Search for a Colorado Place...",
      minCharacters: 8,
      singleLineFieldName: "PlaceName",
      outFields: ["*"]
   }];
      geocoder = new esri.dijit.Geocoder({
    autoNavigate: true, // do not zoom to best result
  autoComplete: true,
  showResults: true, // when true, suggestions are displayed as the user is typing
  maxLocations: 20,
  map: map,
  arcgisGeocoder: false,
  geocoders: myGeocoders
      }, "search");
      geocoder.startup();
   
   // When geocoding is complete. this is also run when you highlight the typed in text to erase it.
   geocoder.on("select", function(results) {
  if (results.result)
   map.centerAndZoom(results.result.feature.geometry, 11);
   //map.setExtent(esri.geometry.getExtentForScale(map, "144448"));
   //map.setScale(144448);
   });


Thanks for the help,
Tammy
0 Kudos
PLadd
by
Occasional Contributor III
I recall having this problem too.  By setting autoNavigate to false, I was able to get the map to refresh properly.  I also set the zoom scale to 17.

Hope you are staying dry out there in CO.
0 Kudos
JohnGravois
Frequent Contributor
i just ran a quick test and patrick is right on the money.  this makes sense because you are handling the navigation yourself rather than relying on the widget to do it for you.
0 Kudos
TammyBearly
New Contributor
Yes, that fixed it. Thanks, we are dry:)

I recall having this problem too.  By setting autoNavigate to false, I was able to get the map to refresh properly.  I also set the zoom scale to 17.

Hope you are staying dry out there in CO.
0 Kudos