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) 


  • possible that your map is displaying in web mercator (aka google projection) and lat/lon need projecting before you centerAt
    – tomfumb
    Jul 7, 2015 at 15:10
  • Even when I give a spatial reference like so it still does not pan to the correct location. var point = new esri.geometry.Point(coord, 102100)
    – mdown
    Jul 7, 2015 at 15:39
  • You'll have to project the point to Web Mercator using the built-in tool geographicToWebMercator.
    – kenbuja
    Jul 7, 2015 at 15:44
  • If you're not using web mercator, make sure it matches whatever coordinate system you assigned.
    – Branco
    Jul 7, 2015 at 16:43

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.


in the code sample above, he's passing longitude and latitude in the wrong order.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.