-1

I am a new to ArcGIS Maps SDK for JavaScript. I have 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");

Do you know the reason and how to fix it?

1
  • I would recommend using version 4.23, there it work without any problems.
    – TomazicM
    Commented Dec 26, 2023 at 9:10

1 Answer 1

2

With version ArcGIS Maps SDK JS 4.23 it works without any problems.

But to make it work correctly you have to also specify CRS for the view extent:

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.