Hi:
I am a newbie to ARCGIS JAVASCRIPT. And I meet a problem when the tileLayer load in, and the zoom controller I set in the top-right is not work well. The plus button can only be invoked event two or three times, and then not working any more, and the minus button can work well. In another aspect of moues, the mouse-wheel event can zoom out/in in perfect behavior. my version is 4.10, my environment is node.js with express, the code snippet is as following:
const basemap = new Basemap({
baseLayers: [
new TileLayer({
url: "https://arcgis.tpgos.gov.taipei/arcgis/rest/services/ED/GD_Plain_Service/MapServer",
title: "Basemap",
crossOrigin: 'anonymous',
spatialReference: {
wkid: 102443
}
})
],
title: "basemap",
id: "basemap",
spatialReference: {
wkid: 102443
}
});
// Create a map using the MapImageLayer
var map = new Map({
basemap: basemap
});
var view = new MapView({
container: "divmap",
map: map,
zoom: 3,
extent: {
xmin: 296938.73458000005,
ymin: 2776832.77203,
xmax: 301876.2566600001,
ymax: 2781271.34259,
},
crossOrigin: 'anonymous',
spatialReference: {
wkid: 102443
} // Set the spatial reference
//spatialReference: { wkid: 102100 } // Set the spatial reference
});
view.ui.move("zoom", "top-right");
is anyone know the exactly reason? and how to fix that, thanks a lot.
Solved! Go to Solution.
Hi there,
You need to specify the spatialReference for the view's extent as the following:
var view = new MapView({
container: "divmap",
map: map,
zoom: 3,
extent: {
xmin: 296938.73458000005,
ymin: 2776832.77203,
xmax: 301876.2566600001,
ymax: 2781271.34259,
spatialReference: {
wkid: 102443
}
},
crossOrigin: 'anonymous',
spatialReference: {
wkid: 102443
}
});
Hi there,
You need to specify the spatialReference for the view's extent as the following:
var view = new MapView({
container: "divmap",
map: map,
zoom: 3,
extent: {
xmin: 296938.73458000005,
ymin: 2776832.77203,
xmax: 301876.2566600001,
ymax: 2781271.34259,
spatialReference: {
wkid: 102443
}
},
crossOrigin: 'anonymous',
spatialReference: {
wkid: 102443
}
});