Skip to main content
added 166 characters in body
Source Link
hoogw
  • 1.8k
  • 1
  • 19
  • 23

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

Recommend:

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));
//or
// map.centerAt(new Point(lng, lat, new SpatialReference({wkid: 4326})));
map.setZoom(18);
  1. arcgis js v4.11 only

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

Warning: you need to

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

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

Recommend:

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));
//or
// map.centerAt(new Point(lng, lat, new SpatialReference({wkid: 4326})));
map.setZoom(18);

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

Recommend:

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));
//or
// map.centerAt(new Point(lng, lat, new SpatialReference({wkid: 4326})));
map.setZoom(18);
  1. arcgis js v4.11 only

           view.center = [_center_long,  _center_lat]
        view.zoom = _center_zoom;
    
added 116 characters in body
Source Link
hoogw
  • 1.8k
  • 1
  • 19
  • 23

Warning: you need to

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

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

Recommend:

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));
//or
// map.centerAt(new Point(lng, lat, new SpatialReference({wkid: 4326})));
map.setZoom(18);

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

Recommend:

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));
//or
// map.centerAt(new Point(lng, lat, new SpatialReference({wkid: 4326})));
map.setZoom(18);

Warning: you need to

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

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

Recommend:

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));
//or
// map.centerAt(new Point(lng, lat, new SpatialReference({wkid: 4326})));
map.setZoom(18);
Source Link
hoogw
  • 1.8k
  • 1
  • 19
  • 23

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

Recommend:

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));
//or
// map.centerAt(new Point(lng, lat, new SpatialReference({wkid: 4326})));
map.setZoom(18);