Docs · JavaScript

Frameworks

JavaScript

Plain HTML — load MapLibre from Orvia's own CDN, no build step or foreign host needed.

Example

index.htmlhtml
1<!-- index.html — no build step; MapLibre is served from Orvia's own CDN -->2<link rel="stylesheet" href="https://orviamaps.ir/cdn/maplibre-gl@5/maplibre-gl.css" />3<script src="https://orviamaps.ir/cdn/maplibre-gl@5/maplibre-gl.js"></script>45<div id="map" style="height: 420px"></div>67<script>8  const KEY = "YOUR_API_KEY";910  const map = new maplibregl.Map({11    container: "map",12    style: `https://orviamaps.ir/api/v1/style.json?key=${KEY}`,13    center: [51.389, 35.689], // Tehran14    zoom: 11,15  });1617  // Search, then fly to the best match18  fetch("https://orviamaps.ir/api/v1/geocode?q=" + encodeURIComponent("اصفهان"), {19    headers: { Authorization: `Bearer ${KEY}` },20  })21    .then((res) => res.json())22    .then(({ result }) => map.flyTo({ center: [result.lon, result.lat], zoom: 12 }));23</script>

Replace YOUR_API_KEY with a key from your account, or read it from an environment variable as shown.