Docs · MapLibre CDN

Resources

MapLibre CDN

MapLibre GL JS, the open-source library that draws Orvia maps in the browser, served from orviamaps.ir.

Because the library comes from the same domain as the API, maps keep loading even when access to foreign CDNs (unpkg, jsDelivr, cdnjs) is cut off.

Versions

VersionFormatFilesAliases
5.24.0Script tag (UMD)maplibre-gl.css, maplibre-gl-csp-worker.js, maplibre-gl-csp.js, maplibre-gl.js@5
6.16.0ES modulemaplibre-gl.css, maplibre-gl-shared.mjs, maplibre-gl-worker.mjs, maplibre-gl.mjs@6 @latest

Pin an exact version (maplibre-gl@5.24.0) — it never changes and is cached for a year — or follow a major version (@5, @6, @latest), which moves to new releases and is cached for an hour.

Script tag (5.x)

No build step; the library is available as the global maplibregl.

<link rel="stylesheet" href="https://orviamaps.ir/cdn/maplibre-gl@5/maplibre-gl.css" />
<script src="https://orviamaps.ir/cdn/maplibre-gl@5/maplibre-gl.js"></script>

<div id="map" style="height: 420px"></div>
<script>
  new maplibregl.Map({
    container: "map",
    style: "https://orviamaps.ir/api/v1/style.json?key=YOUR_API_KEY",
    center: [51.389, 35.689],
    zoom: 11,
  });
</script>

ES module (6.x)

The worker file is loaded from the same folder automatically.

<link rel="stylesheet" href="https://orviamaps.ir/cdn/maplibre-gl@6/maplibre-gl.css" />
<script type="module">
  import { Map } from "https://orviamaps.ir/cdn/maplibre-gl@6/maplibre-gl.mjs";

  new Map({
    container: "map",
    style: "https://orviamaps.ir/api/v1/style.json?key=YOUR_API_KEY",
    center: [51.389, 35.689],
    zoom: 11,
  });
</script>

Strict Content Security Policy

If your site forbids blob: workers, use the CSP build of 5.x: load maplibre-gl-csp.js and point it at its worker with maplibregl.setWorkerUrl("https://orviamaps.ir/cdn/maplibre-gl@5/maplibre-gl-csp-worker.js").

Machine-readable list

https://orviamaps.ir/cdn/manifest.json lists every hosted version, its files and the aliases.