The key-down event invalid in zoom out when using ARCGIS JavaScript in EPSG:3826

321
1
Jump to solution
12-25-2023 10:42 PM
AbramhumHsu
New Contributor III

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.

0 Kudos
1 Solution

Accepted Solutions
UndralBatsukh
Esri Regular Contributor

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
  }
 });

View solution in original post

0 Kudos
1 Reply
UndralBatsukh
Esri Regular Contributor

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
  }
 });
0 Kudos