像 SpatialKey 一样生成密度/热图
SpatialKey 生成一些非常漂亮的热图,我们正在研究为内部项目执行此操作所涉及的内容可视化大量的点。我正在寻找有关从哪里开始的一些想法的反馈(这只是一个非常有趣的问题)。
SpatialKey 热图 http://img697.imageshack.us/img697/7964/resolutiondays508x17550.jpg
我们知道他们正在使用 Flash,并且据我们所知,热图是交互式的,而不是从图块服务器渲染的。我们对其实现方式的第一个猜测是服务器为 Flash 客户端提供一个网格 - 每个单元格都有一个由服务器计算的计数。然后,Flash 客户端根据网格中的单元格值进行一些插值,以生成您在上面看到的漂亮输出。
在这个阶段,我只是对他们如何在服务器端有效地生成网格感兴趣(如果我们对其实现的假设是正确的)。看起来它会涉及:
- 对当前地图边界内的内容执行查询
- 对这些边界内的每个单元格执行聚合子查询(如上例所示进行计数、求和或平均值)。
在一个合理的网格分辨率下以多个缩放级别执行此操作,似乎您需要一个自定义空间索引来提高效率。
有没有人解释一下替代路线?如果重要的话,我们习惯于将数据存储在 PostgreSQL 中,并使用 PostGIS 作为空间索引,但我愿意尝试任何事情。
SpatialKey generates some really nice looking heatmaps, and we're looking into what's involved in doing this for an internal project to visualize large amounts of points. I'm looking for feedback on some ideas on where to get started (and it's just a really interesting problem).
SpatialKey heatmap http://img697.imageshack.us/img697/7964/resolutiondays508x17550.jpg
We know that they're using Flash, and from what we can tell, the heatmaps are interactive rather than being rendered from a tile server. Our first guess at how this is implemented is that the server provides their Flash client with a grid - each cell having a count computed by the server. The Flash client then does some interpolation based on the cell values in the grid to make the pretty output you see above.
At this stage, I'm just interested in how they could possibly generate the grid efficiently server-side (if our assumption on their implementation is even correct). It seems that it would involve:
- Performing a query for what's currently in map bounds
- Performing an aggregation subquery for each cell within those bounds (doing a count, sum, or average as in the example above).
Throw doing this at multiple zoom levels at a sane grid resolution and it seems like you'd need a custom spatial index to make this efficient.
Any takers on explaining an alternative route? If it matters, we're accustomed here to storing our data in PostgreSQL with PostGIS for the spatial index, but I'm open to trying anything.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
作为猜测,我想他们已经在客户端的 Flash 中实现了 GIS 库,并使用它将纬度和经度坐标投影到像素空间中。然后,它们按像素聚合以确定每个像素的“高度”,并像渲染圆形一样渲染它,但使用具有透明度的渐变填充,渐变填充的开始和结束颜色由像素的高度决定。像素。多个圆圈重叠在一起会产生更亮的像素。
另一种方法可能是在灰度中执行此操作,然后将亮度值映射到色标。这可能是最有效的。
我们销售更传统的树状图热图,以便在视觉分析应用程序中集成使用(例如:热图 SDK),现在拥有对区域进行着色的地理热图。我们读取标准的 ESRI Shapefile 地图,并在客户端进行所有投影和渲染(使用 Java,不是 Flash,但概念相同)。我认为 SpatialKey 也在做同样的事情,因为它们支持区域填充渲染,如果您使用像 Google 地图这样的图块服务器,则无法真正完成此操作。
我们还没有制作这样的密度热图,但已经使用静态图像作为背景进行了一些测试。如果您想了解更多信息,请告诉我,我可以询问我的开发人员我们是如何做到的。我知道我们目前正在开发更多基于点的功能,尽管我还不知道密度热图的进度表。
SpatialKey 实际上刚刚写了一篇关于区域填充热图(即:专题图)和密度热图之间差异的好文章。您可以在 http://blog 上查看。 Spatialkey.com/2010/02/comparing-thematic-maps-with-densis-heatmaps/。
如果您确实找到了制作密度热图的好方法,我有兴趣了解您是如何做到的,因为这将是我们的可视化分析 SDK 的一个有价值的补充。祝你好运。
As just a guess, I would imagine they have implemented a GIS library in Flash in the client side and are using this to project latitude and longitude coordinates into a pixel space. Then they aggregate by pixel to determine the "height" of each pixel and render it just like you would render a circle, but using a gradient fill with a transparency, with the start and end colors of the gradient fill determined by the height of the pixel. Multiple circles overlaid on top of each other will create brighter pixels.
An alternative might be to do this in a greyscale, then map the brightness value to a color scale. That might be most efficient.
We sell the more traditional treemap heat maps for integration use in visual analytics applications (eg: heat map SDK), and now have geographic heat maps that colorize areas. We read standard ESRI Shapefile maps and do all the projection and rendering on the client-side (in Java, not Flash, but same concept). I think SpatialKey is doing the same, since they support area-filled rendering, which can't really be done if you are using a tile server like Google Maps.
We're not yet doing density heat maps like this, but have run a couple tests using static images as background. If you want more information, let me know and I can ask my developer how we did it. I know we're currently in development on more point-based features, though I don't know where density heat maps are on the schedule yet.
SpatialKey just actually wrote a good post on the different between area-filled heat maps (ie: thematic maps) and density heat maps. You can check it out at http://blog.spatialkey.com/2010/02/comparing-thematic-maps-with-density-heatmaps/.
If you do figure out a good way of doing density heat maps, I'd be interested in learning how you did it, as it would be a valuable addition to our visual analytics SDK. Best of luck.
MapReduce 用于您的实际聚合地图总数,以及用于数据库的地理空间索引 - 为这些 MapReduce 作业提供数据。我正在考虑实现这种完全相同的方法,但对于接口而不是映射:) MongoDB 目前似乎很合适。
MapReduce for your actual aggregate map totals, and something with Geospatial Indexing for the database - to feed these MapReduce jobs. I'm looking into implementing this exact same approach, but for interfaces instead of maps :) MongoDB seems to be a good fit at the moment.