maplibre-gl-js README

The project's README from github.com/maplibre/maplibre-gl-js. As one markdown file: README.md.

MapLibre Logo

MapLibre GL JS

License Version CI PRs codecov

MapLibre GL JS is an open-source library for publishing maps on your websites or webview based apps. Fast displaying of maps is possible thanks to GPU-accelerated vector tile rendering.

It originated as an open-source fork of mapbox-gl-js, before their switch to a non-OSS license in December 2020. The library's initial versions (1.x) were intended to be a drop-in replacement for the Mapbox’s OSS version (1.x) with additional functionality, but have evolved a lot since then.

Getting Started

Include the CSS file in the <head> of your HTML file.

<link href='https://unpkg.com/maplibre-gl@latest/dist/maplibre-gl.css' rel='stylesheet' />

Include the following code in the <body> of your HTML file.

<div id='map' style='width: 400px; height: 300px;'></div>
<script type='module'>
import * as maplibregl from 'https://unpkg.com/maplibre-gl@latest/dist/maplibre-gl.mjs';

const map = new maplibregl.Map({
  container: 'map',
  style: 'https://demotiles.maplibre.org/style.json', // stylesheet location
  center: [-74.5, 40], // starting position [lng, lat]
  zoom: 9 // starting zoom
});
</script>

Enjoy the map!


Documentation

Full documentation for this library is available here.

Check out the features through examples.

Showcases
Display a map Third party vector tile source
Animate a series of images Create a heatmap layer
3D buildings Visualize population density

Want an example? Have a look at the official MapLibre GL JS Documentation.

Use MapLibre GL JS bindings for React and Angular. Find more at awesome-maplibre.


Contribution

Getting Involved

Join the #maplibre slack channel at OSMUS: get an invite at https://slack.openstreetmap.us/ Read the CONTRIBUTING.md guide in order to get familiar with how we do things around here.

Avoid Fragmentation

If you depend on a free software alternative to mapbox-gl-js, please consider joining our effort! Anyone with a stake in a healthy community-led fork is welcome to help us figure out our next steps. We welcome contributors and leaders! MapLibre GL JS already represents the combined efforts of a few early fork efforts, and we all benefit from "one project" rather than "our way". If you know of other forks, please reach out to them and direct them here.

MapLibre GL JS is developed following Semantic Versioning (2.0.0).

Sponsors

We thank everyone who supported us financially in the past and special thanks to the people and organizations who support us with recurring donations!

Read more about the MapLibre Sponsorship Program at https://maplibre.org/sponsors/.

Gold:

Logo MSFT

Logo AWS

Silver:

Logo MIERUNE

Logo komoot

Logo JawgMaps

Logo Radar

Logo mapme

Logo maptiler

Logo Caltopo

Logo SmartMaps

Backers and Supporters:


Thank you Mapbox 🙏🏽

We'd like to acknowledge the amazing work Mapbox has contributed to open source. The open source community is sad to part ways with them, but we simultaneously feel grateful for everything they already contributed. mapbox-gl-js 1.x is an open source achievement that now lives on as maplibre-gl. We're proud to develop on the shoulders of giants, thank you Mapbox 🙇🏽‍♀️.

Please keep in mind: Unauthorized backports are the biggest threat to the MapLibre project. It is unacceptable to backport code from mapbox-gl-js, which is not covered by the former BSD-3 license. If you are unsure about this issue, please ask!


License

MapLibre GL JS is licensed under the 3-Clause BSD license.

maplibre-gl-js (maplibre/maplibre-gl-js)

Searching Database…

这是做什么的?一个开源 JavaScript 库,用于在网站和基于 webview 的应用中嵌入可交互的矢量瓦片地图,渲染由 GPU 加速。
它是一个我直接链接的在线地图服务,还是放进我自己页面里的代码?它是一个添加到你自己的 HTML 中的客户端库,不是托管服务。它运行在浏览器或 webview 里,通过 WebGL 在 GPU 上绘制矢量瓦片。
怎么在页面里放一个地图?把 MapLibre GL 的 CSS 文件和库代码加到你的 HTML 页面,快速入门里的地图就能跑起来;完整文档和示例都在官方网站上。
用它需要 Node.js 或者构建环境吗?运行时只需要一个浏览器,别的都不用。只有当你想从源码构建这个库本身时,才需要 Node.js 16.14+ 和 npm 8.1+。
它源自 Mapbox,这会带来什么坑吗?代码本身在 BSD-3-Clause 下完全开源,但有一条硬性规定是针对贡献者的:除非符合 mapbox-gl-js 早年 BSD-3 许可证的覆盖范围,否则不得把 mapbox-gl-js 的代码反向移植过来。
我是用 React 的 web 开发者,它适合我的技术栈吗?适合:除了原生 HTML/JS,官方还提供 React 和 Angular 的绑定,而且文档是通过示例来教学的。
它和 Mapbox GL JS 有什么不同?2020 年 12 月,Mapbox 放弃了开源许可证,它随后从 mapbox-gl-js 分叉出来。早期的 1.x 版本力求成为 Mapbox 开源 1.x 的直接替代品,但此后这个库已经按自己的路线发展了很多。
在决定用它之前,我去哪里看它都能做什么?官方文档网站有大量示例和一个案例展示画廊,awesome-maplibre 列表还收集了更多用它的项目和演示。
Creator
maplibre
Size
1 GB
Stars
11.9K
Age
5y
Commits · 90 Days