X
X
xonar2020-02-12 13:27:06
JavaScript
xonar, 2020-02-12 13:27:06

How to change the scale at the same time as changing the coordinates of the center of the map?

Here is the demo .

When clicking on the links under the map, you need to set the center of the map at the corresponding coordinates, as well as change the scale. Couldn't do it through zoom.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2020-02-12
@xonar

map.panTo(...).then(() => map.setZoom(...))
https://jsfiddle.net/q5ujt4Lh/
Or, replace panTo with setCenter - it takes the scale as the second parameter.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question