Leaflet-R – How to Create Independent/Fixed Inset Maps

leaflet-rr

I am trying to create a leaflet map of the USA focusing on the contiguous 48 states and then add two inset maps of Alaska and Hawaii on the side. The problem is that addMiniMap() option creates an interactive inset mini map that just shows the location of the zoom window of the main map. Rather than this, I want to have inset maps with fixed position and zoom on Alaska and Hawaii, while the main map remains interactive.

Best Answer

You need to set centerFixed and zoomLevelFixed:

centerFixed

Applies a fixed position to the minimap regardless of the main map's view / position. Prevents panning the minimap, but does allow zooming (both in the minimap and the main map). If the minimap is zoomed, it will always zoom around the centerFixed point. You can pass in a LatLng-equivalent object. Defaults to false.

zoomLevelFixed

Overrides the offset to apply a fixed zoom level to the minimap regardless of the main map zoom. Set it to any valid zoom level, if unset zoomLevelOffset is used instead.

Source