Warning: you need to
require(["esri/geometry/Point"], function(Point) { /* code goes here */ });
- 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);
arcgis js v4.11 only
view.center = [_center_long, _center_lat] view.zoom = _center_zoom;