Select to view content in your preferred language

Min Max extent not working??

08-18-2021 04:15 AM
Occasional Contributor II


I am using the ESRI JS API 4.2

I am trying to use BNG grid coordinates for the Min/Max extent, and centre.

The map defaults to the world view, not UK extent?? I cannot see why it is not working??

This is the JS script:



        const view = new MapView({
          container: "viewDiv",
          map: map,
		      center: [506032.00000, 194447.000000],
		      //zoom: 15,
		      scale: 50000,
          extent: {
            // autocasts as new Extent()
            xmin: 53976.3289500004,          // 318351.6994,
            ymin: 633750.0000,            // -5.6914500001,
            xmax: -168200.0000,             // 571833.3974,
            ymax: 117983.0000,          // 657535.9723, 
            spatialReference: 27700




I added the following that was listed as a solution in another posting... Still doesn't work??


        view.when(() => {
          // this works too	
          view.extent = layer.fullExtent;


Map extentMap extent


I am using BNG (27700), not WGS84. So I don't see why the centre, extent and zoom is not honoured?? I would appreciate any pointers.



Tags (2)
0 Kudos
1 Reply
Frequent Contributor II

You can set the spatialReference on the MapView but your basemap also needs to match. The default esri basemaps are all web mercator and can't be reprojected.