简体   繁体   English

光栅贴图与替代品

[英]Raster map vs alternative

I recently found this web page Crime in Downtown Houston that I'm interested in reproducing. 我最近在休斯敦市中心找到了这个网页犯罪 ,我有兴趣再现。 This is my first learning experience with mapping in R and thus lack the vocabulary and understanding necessary to make appropriate decisions. 这是我在R中进行映射的第一次学习经验,因此缺乏做出适当决策所必需的词汇和理解。

At the end of the page David Kahle states: 在页面的最后,David Kahle说:

One last point might be helpful. 最后一点可能会有所帮助。 In making these kinds of plots, one might tempted to use the map raster file itself as a background. 在制作这些类型的图时,人们可能会想要使用地图栅格文件本身作为背景。 This method can be used to make map plots much more quickly than the methods described above. 该方法可用于比上述方法更快地制作地图。 However, the method has one very significant disadvantage which, if not handled properly, can destroy the entire purpose of using the map. 然而,该方法具有一个非常显着的缺点,如果处理不当,可能破坏使用地图的整个目的。

  1. In very plain English what is the difference between the raster file approach and his approach? 在非常简单的英语中,光栅文件方法和他的方法有什么区别?
  2. Does the RgoogleMaps package have the ability to produce these types of high quality maps as seen on the page I referenced above that calls a google map into R? RgoogleMaps包是否能够生成这些类型的高质量地图,如上面引用的将谷歌地图调用为R的页面所示?

I ask not because I lack information but the opposite. 我问不是因为我缺乏信息而是相反。 There's too much and I want to make a good decision(s) about the approach to pursue so I'm not wasting my time on outdated or inefficient techniques. 太多了,我想做出一个关于追求方法的好决定,所以我不会把时间浪费在过时或低效的技术上。

Feel free to pass along any readings you think would benefit me. 随意传递您认为对我有益的任何读物。

Thank you in advance for your direction. 提前感谢您的指导。

Basically, you had two options at the time this plot was made: 基本上,这个情节制作时你有两个选择:

  • draw the map as a layer using geom_tile , where each pixel of the image is mapped onto the x,y axes (slow but accurate) 使用geom_tile将地图绘制为图层,其中图像的每个像素都映射到x,y轴(缓慢但准确)

  • add a background image to the plot, as a purely "cosmetic" annotation. 将一个背景图像添加到绘图中,作为纯粹的“装饰性”注释。 This method is faster, because you can use grid.raster which draws images more efficiently, but the image is not constrained by the axes of the plotting region. 此方法更快,因为您可以使用grid.raster更有效地绘制图像,但图像不受绘图区域的轴约束。 In other words, you have to manually adjust the x and y axes limits to make sure that the image corresponds to the actual positions on the plot. 换句话说,您必须手动调整x和y轴限制,以确保图像对应于图上的实际位置。

Now, I would suggest you look at the new annotation_raster in ggplot2 v. 0.9.0. 现在,我建议你在ggplot2查看新的annotation_raster It should have the advantage of speed and leaner output files, and still conform to the data space of the plot. 它应该具有速度和更精简的输出文件的优点,并且仍然符合绘图的数据空间。 I believe that this function, as well as geom_raster and annotation_map did not exist when David made those plots. 我相信当David制作这些图时,这个函数以及geom_rasterannotation_map都不存在。

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

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