简体   繁体   English

Google地图最佳做法?

[英]Google Maps Best Practices?

We started using Google Maps on our web application rather extensively. 我们开始在我们的网络应用程序中广泛使用谷歌地图。 It worked fine at the beginning, but as we add more markers we find that the performance are not quite there. 它在开始时运行良好,但随着我们添加更多标记,我们发现性能并不完全存在。 Although I'm quite sure we don't use it in the most efficient way. 虽然我很确定我们不会以最有效的方式使用它。

I am looking for information about Google Maps best practices and tips'n tricks. 我正在寻找有关Google地图最佳做法和提示的信息。 Any suggestions? 有什么建议?

You might find some good ideas in this article , which compares several methods of handling large amounts of markers. 您可能会在本文中找到一些好主意,它会比较处理大量标记的几种方法。

Marker Manager has some limitations, depending on what you're trying to accomplish; 标记管理器有一些限制,取决于您要完成的任务; for instance, it doesn't allow every marker to be available from every zoom level. 例如,它不允许每个标记从每个缩放级别可用。 I created a clustering function based on the principles discussed in this tutorial . 我基于本教程中讨论的原理创建了一个聚类函数。 It uses the Static Maps API in PHP, but the principles behind the clustering can be used however you want. 它使用PHP中的Static Maps API,但可以根据需要使用群集背后的原理。

Update: This clustering utility was just released: MarkerClusterer 更新:此群集实用程序刚刚发布: MarkerClusterer

使用标记管理器

  • Limit markers to what's visible (ie, understand the window boundaries, and only show markers that fall inside the window) 将标记限制为可见的(即,了解窗口边界,并仅显示落在窗口内的标记)
  • Learn to listen for various map activities and react - such as viewpoint moves, zooming, etc - to update the markers 学习聆听各种地图活动并做出反应 - 例如视点移动,缩放等 - 来更新标记
  • Don't show markers that overlap significantly - show only one marker (perhaps a different shade or color to denote there are several points at this marker) and let the user zoom in if they want to see the individual markers. 不要显示重叠显着的标记 - 仅显示一个标记(可能是不同的阴影或颜色,表示此标记处有多个点),如果用户想要查看各个标记,请让用户放大。 Use the tooltip to show a zoomed in window if you want to get fancy. 如果您想获得幻想,请使用工具提示显示放大的窗口。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM