How to display a minimap or overview map control to aid the map navigation

This tutorial shows how to display a minimap or overview map control in MapTiler SDK JS to aid map navigation.

By following this guide, users will learn how to integrate and display a minimap within their map interface using MapTiler SDK JS. The minimap provides users with a compact overview of the entire map, allowing them to easily navigate and explore different areas. With the help of MapTiler SDK JS, developers can effortlessly incorporate a minimap control into their web-based mapping applications, making it easier for users to interact with and navigate through their maps.

NPM module setup


npm install --save @maptiler/sdk
import { Map, MapStyle, config } from '@maptiler/sdk';
import '@maptiler/sdk/dist/maptiler-sdk.css';

config.apiKey = 'YOUR_MAPTILER_API_KEY_HERE';
const map = new Map({
  container: 'map', // container id
  style: MapStyle.STREETS,
  center: [16.62662018, 49.2125578], // starting position [lng, lat]
  zoom: 10, // starting zoom
  minimap: {
    containerStyle: {
      width: '200px',
      height: '150px'
    }
  }
});

Learn more

By default, the control uses the same style as the map but we can use a different style on the minimapControl. Example of the control using the Satellite Hybrid Map and changing the size of the map.

Visit the JavaScript Maps API reference to learn how to create your custom control.

Scale control display

Scale control

Tutorials

Learn to add and display map scale control.

Elevation profile control

Add elevation profile control

Examples

Show elevation profiles for GeoJSON traces using MapTiler.

Distance measurement on map

Measure distances

Examples

To calculate distances on the map, simply click on different points to create lines that will measure the distances using turf.length.

Change the default position for attribution

Change attribution default position

Examples

Position map attribution in the top-left corner on initialization.

Was this helpful?