简体   繁体   English

热图可视化显示Google Maps中的离散值

[英]Heat map visualization for discrete values on Google Maps

I'm working on the following scenario: I have a geographical location and I need to create a heat-map visualization of travel times (by car) from that location to anywhere around. 我正在研究以下情形:我有一个地理位置,我需要创建一个热图可视化图表,显示从该位置到周围任何地方(乘车)的旅行时间。 I'm planning on using Google Distance Matrix API for getting travel duration. 我正计划使用Google Distance Matrix API来获取旅行时间。 But, since it has a limit on the no of API calls, I need to somehow limit the calls. 但是,由于它对API调用的数量有限制,因此我需要以某种方式限制调用。

My plan, so far, is the following: compute the travel duration (basically a numeric value) to a set of points evenly distributed on a grid around the given position (eg 0.5km east, 0.5 km east-0.5km north, 0.5 km east-1 km north etc.). 到目前为止,我的计划如下:计算到在给定位置(例如,东0.5公里,东0.5公里,北0.5公里,北0.5公里)上均匀分布在网格上的一组点的行驶持续时间(基本上是一个数值)东1公里,北等)。 This points would represent the centers of square-shaped areas and I will consider the travel duration to the center as the travel duration to anywhere in the area. 这些点将代表方形区域的中心,我将考虑到中心的旅行持续时间视为到该区域任何地方的旅行持续时间。 Display these areas as colored squares on a Google Maps in a heatmap style. 以热图样式在Google地图上将这些区域显示为彩色正方形。

A good example of something that looks alike is this: http://project.wnyc.org/transit-time/#40.72280,-73.95464,12,709 . 一个类似的东西很好的例子是: http : //project.wnyc.org/transit-time/#40.72280,-73.95464,12,709

So, my questions are: 因此,我的问题是:

  1. Does it seem like a good strategy? 这似乎是个好策略吗?
  2. Is there a better visualisation strategy for something like this? 对于这样的事情,是否有更好的可视化策略?
  3. How can I create those square-shaped colored areas on Google Maps? 如何在Google地图上创建方形彩色区域?

Thanks! 谢谢!

Calculating duration would surely involve traffic flow rather than simply distance. 计算持续时间肯定会涉及交通流量,而不仅仅是距离。 If your calculations are purely on distance you could use the Google Maps direction requests to calculate the distance to each point. 如果您的计算完全基于距离,则可以使用Google Maps方向请求来计算到每个点的距离。

  1. I'm not sure a heat map is the way forward for this scenario. 我不确定在这种情况下热图是否是前进的方向。
  2. There a number of way you could achieve this. 您可以通过多种方式实现这一目标。 Here's a few: 这里是一些:

    a. 一种。 Use a custom overlay ( https://developers.google.com/maps/documentation/javascript/examples/overlay-simple ) 使用自定义叠加层( https://developers.google.com/maps/documentation/javascript/examples/overlay-simple

    b. Draw polygons on the map and give them different colours based on the journey duration. 在地图上绘制多边形,并根据旅程持续时间为它们指定不同的颜色。 This would involve taking the area in question and slicing it up in to polygons however you need to. 这将涉及将问题区域切成多边形,但是您需要这样做。 These polygons could take the same shape as your example. 这些多边形可以采用与您的示例相同的形状。 You would need to be rather precise with your latlng. 您需要精通latlng。 SQL's spacial querys would help you here depending on the tech your using. SQL的空间查询将根据您使用的技术为您提供帮助。 ( https://developers.google.com/maps/documentation/javascript/examples/polygon-arrays ) https://developers.google.com/maps/documentation/javascript/examples/polygon-arrays

    c. C。 Depending on how specific you wanted to be you could draw circles with different radius value and different colours. 根据您想要的具体程度,您可以绘制具有不同半径值和不同颜色的圆。

    d. d。 You could make custom markers in the shapes you require and add them to the map in the correct latlng in order to fill an area. 您可以在所需的形状中创建自定义标记,然后将其以正确的样式添加到地图中以填充区域。 You could have different markers for different duration and add them accordingly. 您可以为不同的持续时间设置不同的标记,并相应地添加它们。

I'm sure there are other options as well. 我敢肯定还有其他选择。

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

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