OK, this is fun! First, I didn't need to tear apart the results to get x, y, and spatial reference. I simply need to use the geometry of the object itself as follows:geom = results.results.results[0].feature.geometry;
and then use that as follows:map.centerAndZoom(geom, 20);
Sadly, however, after all of that searching and coding, I learned that when I use the following for geocoding, I lose the ability to ID the map.var gc = [{
url: "http://MyURL/arcgis/rest/services/myGeocoder/GeocoderServer",
name: "theGeocoder",
singleLineFieldName: "Street"
}];
var geocoder = new esri.dijit.Geocoder({
map: map,
autoNavigate: true,
autoComplete: true,
geocoders: gc,
geocoderMenu: false,
arcgisGeocoder: false,
placeholder: "142 East Main St"
}, "search");
geocoder.startup();
But with the generic code, I can ID the mapgeocoder = new esri.dijit.Geocoder({
map: map,
autocomplete: true,
placehoder: "Find a place",
//searchExtent: search_extent,
arcgisGeocoder: {
name: "Esri World Geocoder"
}
}, "search");
geocoder.startup();
Anybody care to guess why I can't ID the map using this code?