Skip to content

Logo Control

Every map built on the community styles must show the Maptoolkit logo, see Attribution. @maptoolkit/maplibre-logo-control adds it to a MapLibre GL JS map as a control that links to maptoolkit.org.

Install

npm install @maptoolkit/maplibre-logo-control maplibre-gl

Usage

import * as maplibregl from "maplibre-gl";
import { LogoControl } from "@maptoolkit/maplibre-logo-control";
import "@maptoolkit/maplibre-logo-control/style.css";

const map = new maplibregl.Map({
  container: "map",
  style: "https://styles.maptoolkit.org/summer.json",
  center: [16.3738, 48.2082],
  zoom: 12,
});

map.addControl(new LogoControl());

The control sits in the bottom-left corner. Pass a position to addControl to move it, and keep other controls out of that corner so they do not cover the logo.

The variant option decides where the logo links to. Its default, "org", links to maptoolkit.org, which is the right target for the community styles.

Without a bundler

The package is an ES module only. Load it from a CDN and map maplibre-gl in an import map:

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/maplibre-gl@6.16.0/dist/maplibre-gl.css" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@maptoolkit/maplibre-logo-control@1.1.2/dist/maplibre-logo-control.css" />

<script type="importmap">
  {
    "imports": {
      "maplibre-gl": "https://cdn.jsdelivr.net/npm/maplibre-gl@6.16.0/dist/maplibre-gl.mjs"
    }
  }
</script>
<script type="module">
  import * as maplibregl from "maplibre-gl";
  import { LogoControl } from "https://cdn.jsdelivr.net/npm/@maptoolkit/maplibre-logo-control@1.1.2/dist/maplibre-logo-control.js";

  const map = new maplibregl.Map({
    container: "map",
    style: "https://styles.maptoolkit.org/summer.json",
    center: [16.3738, 48.2082],
    zoom: 12,
  });
  map.addControl(new LogoControl());
</script>

Reference

The Logo Control reference on docs.maptoolkit.com describes the variant option.

License

The Logo Control is open source under the BSD 3-Clause License.