Trying to center the map at a certain coordinates but map only centers at 0,0 instead. Coordinates are in decimal degrees. Code below.
function foo(data) {
var lon = data.address.longitude;
var lat = data.address.latitude;
var coord = [lat,lon];
var point = new esri.geometry.Point(coord)
console.log(point)
map.centerAt(point);
};
1 Answer 1
im going to have to disagree with everyone in the comments.
if @mdown 's application loads web mercator tiles, he can pass a long/lat pair to map.centerAt()
and skip declaring the spatial reference entirely because the API assumes WGS84 when nothing else is specified (docced here) and is able to reproject the values appropriately on the fly.
http://jsbin.com/yogugecago/edit?html,output
in the code sample above, he's passing longitude and latitude in the wrong order.
centerAt