I was just wondering if there is a way to make the map always show the same extent, regardless
of the size of the <div> element containing it?
Something like an auto zoom function so the map always shows the same area?
5 Answers, 1 is accepted
The Map extent method can be used as a setter in order to ensure that the given region is visible.
It must be called after the map is initialized, as the initial configuration covers only center and zoom.
For example, check out this snippet:
var aus = new kendo.dataviz.map.Extent(
[-10.683333, 113.155], // North West location
[-39.138889, 153.638889] // South East location
I hope this helps.
With the extent method it appears that when it zooms to the extent it is rounding the zoom level. It is really nice that the initial zoom of the map can be in decimal form, can the extent do the same? For example when it zooms from an extent call if it needs to zoom to 4.67 it would instead of rounding to 4.5
Map zoom level can be controlled via the zoom method. However, only whole numbers can be used. If a decimal is entered it will be rounded to the nearest integer.
Viktor thank you. The issue / recommendation is not the zoom method. What is happening is when I use map.extent to zoom to a bounding box that method is setting the zoom level to a whole number or in some cases 1/2 increments such as 6, 6.5, 7 or 7.5 so you do not get the depth that would be desired. This does not seem to happen when working with markers, but only when doing bounding box with shapes. It would be nice to also allow a padding property to the extent method (This is what Mapbox FitBounds does).
Is there a better way I can achieve my goal?
I am afraid that currently padding is not available for the extent method. Nevertheless, you can submit a feature request in our feedback portal for this. We monitor the feedback portal and based on the votes from customers the requests are considered for implementation.