Better map shape adjustment


#1

Hi all. I’ve been playing with the US Geo Map and the drill hierarchy configuration to go into a county shape when clicking a state (filter by state) and it works well so far. I’ve noticed when zooming in or out, that the shape goes too big or too small. Here is what I’m referring to:

Here is Arkansas with a zoom level of 6:

Now with a zoom level of 7:

Is like there is no intermediate step. I’ve been trying to use decimal values for the zoom but no luck. Is there a way to have these “intermediate” values?


#2

Hi @maxeros. That’s the default behaviour for the zoom property. If you want to modify the zoom step value use the zoomSnap and zoomDelta properties, for example:

map.set('zoomSnap', 0.5)
map.set('zoomDelta', 0.5)

Basically, they allow you to use decimal values for the zoom property and how much it should increase or decrease when you click the + or - buttons from the map. See the doc here.


#3

Crazy good. Solved! Thanks, @eduardo, You saved me from adjusting the size of the visualization.


#4

To avoid opening a new thread I’ll continue with this having in consideration my next question is related:

In my drill hierarchy configuration, I have now (finally!) a zoom level and center defined for each state shape in the Geo Map, so when a filter is applied it will be rendered properly. Everything was ok till I’ve tested the app in a different screen resolution (a smaller one). It turns out that now the container is smaller, hence the shapes look big and I have to zoom out to make it look centered again.

So I guess my next question is… have you dealt with this issue? I could get a workaround using window.screen but my drill configuration can get humongous.


#5

Use the fitBounds setting. That will automatically adjust the shape into the viewport. Better described also in the documentation :slight_smile: