Select to view content in your preferred language

Zoom levels and specific scale

225
1
Jump to solution
09-11-2024 10:52 PM
KaiBehncke
Occasional Contributor

Dear community, does anybody know a solution for the following?:

The map starts with a zoom level of a scale of 50.000.

I would like that after zoomIn via mousewheel

the scale is 25.000, and after next zoomin 10000 and safter the next zoomin: 5000.

Has anybody an idea?

 

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
KaiBehncke
Occasional Contributor

 

Allright, I got it:

The constraint snapToZoom should be false;

 

  const view = new MapView({ container: "viewDiv", map: map, zoom: 3, center: new Point({ x: 413036, y: 5791444, spatialReference : 25832 }), highlightOptions: { color: [192, 55, 44, 1], width: 2, fillOpacity: 0 }, constraints: { rotationEnabled: false , snapToZoom: false } }); 

And afterwards:

reactiveUtils.watch( () => [view.stationary, view.scale], ([stationary, scale]) => { if (stationary) { alert ("hello"+view.zoom); if (view.zoom==5){ view.scale=3000; } 

 

View solution in original post

0 Kudos
1 Reply
KaiBehncke
Occasional Contributor

 

Allright, I got it:

The constraint snapToZoom should be false;

 

  const view = new MapView({ container: "viewDiv", map: map, zoom: 3, center: new Point({ x: 413036, y: 5791444, spatialReference : 25832 }), highlightOptions: { color: [192, 55, 44, 1], width: 2, fillOpacity: 0 }, constraints: { rotationEnabled: false , snapToZoom: false } }); 

And afterwards:

reactiveUtils.watch( () => [view.stationary, view.scale], ([stationary, scale]) => { if (stationary) { alert ("hello"+view.zoom); if (view.zoom==5){ view.scale=3000; } 

 

0 Kudos