I am using Arcgis javascript API for my map where map is coming from arcgis online using map by ID. Now I want to set map center using Lat long,For this I am using this method to set map center


But this method is not working for me. Does anybody know how to set map center using Lat Long In Arcgis javascript API.

2 Answers 2


the centerAt() method expects a point geometry object.

//pass long,lat and don't forget to load the appropriate AMD module
map.centerAt(new Point(-118.15, 33.80));
map.centerAt(new Point(-118.15, 33.80, new SpatialReference(4326)));

this is mentioned in the API reference: https://developers.arcgis.com/javascript/jsapi/map-amd.html#centerat

the object can be constructed using WGS84 coordinates without specifying a spatial reference, but it doesn't hurt anything to include it.


  • Since my reputation is < 50 I can't add a comment to the answer provided, however, I would like to point out that second version of the map.centreAt does not work. It should be: map.centerAt(new Point(-118.15, 33.80, new SpatialReference({wkid: 4326}))); Note the braces around wkid: 4326 this defines the object passed in to the SpatialReference constructor. Without that javascript assumes they are two parameters being passed in and should be separated with a comma. There is also an extra closing parenthesis required.
    – Graham H
    Commented Nov 10, 2016 at 22:34
  • It says Point is not defined. And when I add it to require and function statements, it says Point is not a constructor. Commented Mar 13, 2020 at 8:16
  • 1
    I'd willing to bet that it's because the order of the AMD modules you're importing doesn't match the order of the variable names you refer to them by in the callback. Commented Mar 14, 2020 at 14:20
  • thanks for catching that typo. 4 years later, but I just fixed my snippet to just use a number. Commented Mar 14, 2020 at 14:21
  • @JohnGravois you were damn right! It was just a mismatch between the two lists. Thank you! Commented Mar 17, 2020 at 13:26

Warning: you need to

      require(["esri/geometry/Point"], function(Point) { /* code goes here */ });

1) arcgis js api v3.28 only,

For example, I want map center at lng, lat with zoom level 18


map.centerAndZoom(new Point(lng, lat), 18);

Alternative: (sometimes, it failed to move the map, maybe ESRI need to fix bug for Javascript api v3.24)

map.centerAt(new Point(lng, lat));
// map.centerAt(new Point(lng, lat, new SpatialReference({wkid: 4326})));

2) arcgis js v4.11 only

          view.center = [_center_long,  _center_lat]
       view.zoom = _center_zoom;

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.