Skip to content

Add the Maptoolkit Logo to MapLibre GL JS

NPM License GitHub

A MapLibre GL JS control plugin that adds a maptoolkit logo link to the map.

Live demo

Install

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

Built and tested against maplibre-gl v6.

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, center, zoom });
map.addControl(new LogoControl());

By default the control is placed in the bottom-left corner; pass a position to addControl to change that:

map.addControl(new LogoControl(), "bottom-right");

Options

OptionTypeDefaultDescription
variant"org" | "com""org"Which Maptoolkit offering the logo links to (maptoolkit.org or maptoolkit.com).
map.addControl(new LogoControl({ variant: "com" }));

Without a bundler

The package is ESM-only (no UMD/CJS build). Loading it straight from a CDN via a <script> tag works with an import map to resolve the bare maplibre-gl specifier:

<link href="https://unpkg.com/maplibre-gl@^6.0.0/dist/maplibre-gl.css" rel="stylesheet" />
<link href="https://unpkg.com/@maptoolkit/maplibre-logo-control@^1.0.0/dist/maplibre-logo-control.css" rel="stylesheet" />

<script type="importmap">
  {
    "imports": {
      "maplibre-gl": "https://unpkg.com/maplibre-gl@^6.0.0/dist/maplibre-gl.mjs"
    }
  }
</script>
<script type="module">
  import * as maplibregl from "maplibre-gl";
  import { LogoControl } from "https://unpkg.com/@maptoolkit/maplibre-logo-control@^1.0.0/dist/maplibre-logo-control.js";

  const map = new maplibregl.Map({ container: "map", style, center, zoom });
  map.addControl(new LogoControl());
</script>

License

maplibre-logo-control is open-source under the BSD 3-Clause License.