require([
'esri/Map',
'esri/views/MapView',
"esri/geometry/Extent",
"esri/geometry/SpatialReference",
], function (
Map,MapView,Extent,SpatialReference
) {
//如果自定义切图底图则不需要basenap
var map = new Map({basemap:'osm'});
var mapView = new MapView({
//center: [84.87, 42.57], // long, lat
container: "containid",
map: map,
constraints: {
minZoom: 3,
maxZoom: 18,
snapToZoom: false
},
zoom: 1
});
//地图初始化范围
mapView.extent = new Extent(8181888.285583924, 4073662.410032952, 10729665.6017059,
6305376.552373809, new SpatialReference({wkid: 3857}));
// esri移除水印
mapView.ui.remove(['attribution']);
//放大缩小按钮
mapView.ui.move("zoom", "top-right");
//矢量服务设置比例
mapView.scale = 240000
})
ArcGIS API for JavaScript(4.x)初始化地图
最新推荐文章于 2023-08-07 14:18:23 发布