在Google Maps中使用Leaflet? [英] Using Leaflet with Google Maps?

查看:85
本文介绍了在Google Maps中使用Leaflet?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当前,我正在使用Google Maps API 3来显示大约1000个分布在世界各地的用户.这是免费的免费每天下载的地图视图少于25.000.

Currently I am using Google Maps API 3 to display about 1000 users spread all over the world. This is for free, as long as I have less then 25.000 downloaded maps views per day.

最近,我发现了令人惊叹的JS库传单.我想将它与 OpenStreetMaps 一起使用.据我了解,不应使用OpenStreetMaps提供的磁贴(瓷砖使用政策 ),而是使用OSM数据制作图块或自行生成图块的第三方提供商.

Recently, I found out about the amazing JS Library Leaflet. I want to use it with OpenStreetMaps. As far as I have understood, one should not use tiles provided by OpenStreetMaps (Tile usage policy) but instead third party provider that makes tiles from OSM data, or generate your own.

我无法提供自己的磁贴,因为我没有适当的硬件要求. 不幸的是,我发现许多瓷砖的第三方提供商都有非常严格的限制,例如 MapQuest ,它仅免费提供,只要您每个 的地图浏览量不超过15.000(与Google Maps相比,它看起来不那么吸引人,在Google Maps中,您可以免费使用它,只要不超过每天 可获得25.000次地图浏览.)

I cannot provide my own tiles because I do not have appropriate hardware requirements. Unfortunately I found that many third party provider for tiles have very strict limits, like MapQuest which is only for free as long as you do not exceed 15.000 map views per month (which seems not very attractive in comparison with Google Maps where you can use it for free as long as you do not exceed 25.000 map views per day).

所以我想知道,是否可以将Leaflet与Google Maps一起使用,这样我每 只能有25.000张地图视图?

So I wonder, is it possible to use Leaflet with Google Maps, so that I only have a limit of 25.000 map views per day?

根据此问题答案显然是不. 但是,根据带有Google卫星图层的传单地图API ,答案是是的.

According to this question the answer is clearly no. However, according to Leaflet Map API with Google Satellite Layer the answer is yes.

推荐答案

好,在这里要说很多.

1)只要合理使用,就可以使用OSM磁贴.如果您发现MapQuest的限制非常严格,那么的确可能处于过度合理"的情况.

1) You can use OSM tiles as long as your usage is reasonable. If you find MapQuest limits quite restrictive, then indeed, you would probably be in the "over-reasonable" situation.

2)对于图块源(包括MapQuest和Google Maps),您有很多第三方的替代方案.如果您处于每月或每天产生数千个视图的情况下,那么为商业服务付费并确保一定的可用性服务水平可能是值得的.当然,Google Maps仍然是免费的,并且对于高使用率具有吸引力,但要符合其条件(见下文).

2) You have plenty 3rd party alternatives for tile sources (including MapQuest and Google Maps). If you are in the situation where you generate several thousands of views per month or day, then it is probably worth paying for a commercial service and ensure some availability service level. Of course Google Maps is still free and attractive for a high usage, at the cost of complying with their conditions (below).

3)Google Maps条款规定您只能通过Google Maps API使用Google Maps磁贴.这就是某些Leaflet插件提供的功能:它们充当代理并使用Google Maps API,因此您应遵守Google Maps服务条款.那可能是您应该提供API密钥的地方.

3) Google Maps terms state that you can use Google Maps tiles only through Google Maps API. That is what some Leaflet plugins provide: they act as a proxy and use Google Maps API, so you should be compliant with Google Maps service terms. That is where you should probably provide your API key.

4)因此,您显示的直接使用Google Maps磁贴模板URL的代码段即使在技术上可行,也很可能不符合其条款.

4) Therefore, the code snippet you show, which directly uses Google Maps tile template URL, is very probably not compliant with their terms, even though it may technically work.

请注意,在用于磁贴源的商业第三方服务中,有 Mapbox .我不太喜欢广告,但是我提到它是因为这是Leaflet主要作者所在的公司.

As a side note, among the commercial 3rd party services for tile source, there is Mapbox. I do not especially like advertising, but I mention it because this is the company where the main Leaflet author works.

这篇关于在Google Maps中使用Leaflet?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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