OpenFreeMap 是一個開源的地圖服務平台,允許使用者免費將自定義地圖整合至網站或應用程式中。其地圖數據來自 OpenStreetMap,並且使用者可以選擇自我託管或使用其公開的地圖服務,無需 API 金鑰、註冊或使用者數據。該平台強調無限制的地圖檢視次數,且完全依賴捐贈來支撐運營成本,特別適合尋求免費、高效地圖託管解決方案的開發者和小型團隊。

使用方法如下:

讀取 js 及 CSS:

<script src="https://unpkg.com/maplibre-gl/dist/maplibre-gl.js"></script>
<link href="https://unpkg.com/maplibre-gl/dist/maplibre-gl.css" rel="stylesheet" />

初始化:

<div id="map" style="width: 100%; height: 500px"></div>
<script>
  const map = new maplibregl.Map({
    style: 'https://tiles.openfreemap.org/styles/liberty',
    center: [13.388, 52.517],
    zoom: 9.5,
    container: 'map',
  })
</script>