Mapnik 的 R 绑定?
我经常发现自己在 R 中进行一些分析,然后想要制作一个快速地图。标准的plot()函数做得相当快,但我很快发现当我想要制作一些看起来不错或具有更复杂的符号系统要求的东西时,我需要使用ggplot2。 Ggplot2 很棒,但有时将 SpatialPolygonsDataFrame 转换为 Ggplot2 所需的格式很麻烦。当处理需要特定投影的大型地图时,Ggplot2 也可能有点慢。
看起来我应该能够使用 Mapnik 直接从 R 绘制空间对象,但是在用尽我的 Google-fu 之后,我找不到任何绑定的证据。我没有假设这样的事情不存在,而是想在这里检查一下是否有人知道 R - Mapnik 绑定。
I frequently find myself doing some analysis in R and then wanting to make a quick map. The standard plot() function does a reasonable job of quick, but I quickly find that I need to go to ggplot2 when I want to make something that looks nice or has more complex symbology requirements. Ggplot2 is great, but is sometimes cumbersome to convert a SpatialPolygonsDataFrame into the format required by Ggplot2. Ggplot2 can also be a tad slow when dealing with large maps that require specific projections.
It seems like I should be able to use Mapnik to plot spatial objects directly from R, but after exhausting my Google-fu, I cannot find any evidence of bindings. Rather than assume that such a thing doesn't exist, I thought I'd check here to see if anyone knows of an R - Mapnik binding.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Mapnik 常见问题解答 明确提到了 Python 绑定 - wiki - 没有提到 R,所以我认为你是正确的,Mapnik 目前不存在(至少由 Mapnik 赞助的)R 绑定。
通过询问 Mapnik 用户列表,您可能会得到更令人满意(或至少更详细)的答案。他们会确切地知道是否存在为 Mapnik 制作 R 绑定的项目,如果没有,您的兴趣可能会促使某人调查为 R 生成绑定的可能性。
The Mapnik FAQ explicitly mentions Python bindings -- as does the wiki -- with no mention of R, so I think you are correct that no (Mapnik-sponsored, at least) R bindings currently exist for Mapnik.
You might get a more satisfying (or at least more detailed) answer by asking on the Mapnik users list. They will know for certain if any projects exist to make R bindings for Mapnik, and if not, your interest may incite someone to investigate the possibility of generating bindings for R.
我会将 SpatialWotsitDataFrames 写入 Shapefiles,然后启动 Python Mapnik 脚本。您甚至可以使用 R 生成 Python 脚本(“brew”包可以方便地从模板创建文件并从 R 插入值)。
I would write the SpatialWotsitDataFrames to Shapefiles and then launch a Python Mapnik script. You could even use R to generate the Python script (package 'brew' is handy for making files from templates and inserting values form R).