javascript – Mapbox GL JS vs. Mapbox.js

来自Mapbox词汇表,Mapbox.js

Mapbox.js is a JavaScript library that allows you to add an your interactive map to your website. It is a plugin for Leaflet, and it is an open source library that’s free to use.

Mapbox GL JS

Mapbox GL JS is a JavaScript library that uses Mapbox GL to render interactive maps. It’s an open source library that’s free to use. You can add a Mapbox style or a custom style created with Mapbox Studio to your Mapbox GL JS application.

this answer

Mapbox Styles are for use with Mapbox GL and the native iOS and Android SDK’s. You can’t use them with classic Mapbox JS. Mapbox JS supports raster tiles, you can’t style those. They’re just images. Mapbox GL and the native SDK’s (can) use vector tiles and those are stylable.

我相信我可以使用mapbox.js作为传单css和js源的替代,但我可以用mapbox-gl.js做同样的事情吗?
两个库之间还存在哪些差异?

解决方法:

据我所知,Mapbox GL JS将成为当前使用Leaflet的Mapbox JS的替代品. Leaflet做了很多事情,GL也可以做得更多.但不是一切.反之亦然. GL可以做Leaflet不能做的事情. GL中最重要的是它使用WebGL围绕矢量切片构建.从介绍文章:

Announcing Mapbox GL JS — a fast and powerful new system for web maps. Mapbox GL JS is a client-side renderer, so it uses JavaScript and WebGL to dynamically draw data with the speed and smoothness of a video game. Instead of fixing styles and zoom levels at the server level, Mapbox GL puts power in JavaScript, allowing for dynamic styling and freeform interactivity. Vector maps are the next evolution, and we’re excited to see what developers build with this framework.

如果你真的想要两者并排比较,我很遗憾没有据我所知.在进行比较时,有太多的事情需要提及/考虑,所以最好根据自己的要求自己做这样的事情.一个好的开始是比较每个框架的示例,因为它可以很好地了解两者可以做什么:

> https://www.mapbox.com/mapbox-gl-js/examples/
> https://www.mapbox.com/mapbox.js/example/v1.0.0/

之后你可以比较他们的API:

> https://www.mapbox.com/mapbox-gl-js/api/
> https://www.mapbox.com/mapbox.js/api/v2.2.4/

需要记住的一点是,GL是新品牌,我们的开发人员都知道价格合理.一些纠结没有被解决.至于Leaflet,它非常成熟,使用广泛,经过充分测试/验证.如果你想看一下GL目前遇到的问题,你可以在存储库中查看Github上的问题:

> https://github.com/mapbox/mapbox-gl-js/issues

希望有所帮助,祝你好运!

上一篇:javascript – 使用基于本地geojson文件的mapbox进行3D挤压


下一篇:java – 设置标注图像mapbox android