Mapbox GL JS与Mapbox.js [英] Mapbox GL JS vs. Mapbox.js

查看:131
本文介绍了Mapbox GL JS与Mapbox.js的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Mapbox词汇表中, Mapbox.js

From the Mapbox glossary, Mapbox.js

Mapbox.js是一个JavaScript库,允许您将交互式地图添加到您的网站.它是Leaflet的插件,并且是一个免费使用的开源库.

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是一个JavaScript库,它使用Mapbox GL渲染交互式地图.这是一个免费的开放源代码库.您可以将Mapbox样式或使用Mapbox Studio创建的自定义样式添加到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.

以及来自此答案

Mapbox样式可用于Mapbox GL以及本机iOS和Android SDK.您不能在经典的Mapbox JS中使用它们. Mapbox JS支持栅格图块,您无法设置样式.它们只是图像. Mapbox GL和本机SDK可以使用矢量图块,并且它们是可样式化的.

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代替leaflet cssjs源,但是我可以对mapbox-gl.js做同样的事情吗?
两个库之间还有哪些其他区别?

I believe I can use mapbox.js as a replacement to the leaflet css and js sources, but can I do the same with mapbox-gl.js?
What other differences exist between the two libraries?

推荐答案

据我所知,Mapbox GL JS将替代当前在后台使用Leaflet的Mapbox JS. Leaflet可以做很多事情,GL可以做得更多.但是,并非一切.反之亦然. GL可以做Leaflet无法做的事情. GL中最大的优点是它是使用WebGL围绕矢量图块构建的.在介绍文章中:

As far as i know, Mapbox GL JS is going to be the replacement for the current Mapbox JS which uses Leaflet in the background. A lot of things Leaflet does, GL can do too and more. But not everything. The same goes vice versa. GL can do things Leaflet can't do. The big thing in GL is that it's built around vector tiles using WebGL. From the introduction article:

宣布Mapbox GL JS —一种快速而强大的网络地图新系统. Mapbox GL JS是客户端渲染器,因此它使用JavaScript和WebGL以视频游戏的速度和流畅性动态绘制数据. Mapbox GL并没有在服务器级别固定样式和缩放级别,而是在JavaScript中添加了功能,从而实现了动态样式和自由形式的交互性.矢量地图是下一个发展,我们很高兴看到开发人员使用此框架构建的内容.

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.

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

If you really want a side by side comparison of the two, I'm sorry there is none as far as I know. There are too many things to mention/consider when making a comparison so it's best you do such a thing by yourself based upon your own requirements. A good start would be comparing the examples for each framework because it gives a good idea of what both can do:

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

之后,您可以比较他们的API:

After that you could compare their API's:

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

要记住的一件事是,GL是崭新的品牌,而且我们开发人员都知道,这是有代价的.一些纠结尚未消除.至于Leaflet,它已经非常成熟,被广泛使用并且经过了很好的测试/验证.如果您想看看GL当前存在哪些问题,可以在存储库中的Github上查看问题:

One thing to keep in mind is that GL is brand spanking new and as we developers all know that comes with a price. Some kinks haven't been ironed out. As for Leaflet, it's very mature, widely used and very well tested/proven. If you'd like to take a peek at what problems there are currently with GL you could take a look at the issues over at Github, in the repository:

希望有帮助,祝你好运!

Hope that helps, good luck!

这篇关于Mapbox GL JS与Mapbox.js的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆