5

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.

Peter
  • 4,219
  • 4
  • 28
  • 40

2 Answers2

1

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.

David Alber
  • 17,624
  • 6
  • 65
  • 71
1

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).

Spacedman
  • 92,590
  • 12
  • 140
  • 224
  • Have thought about this one as well, but would love to be able to do it all from R. This is definitely a workaround though. – Peter Sep 24 '11 at 20:21
  • You might be able to use Rcpp to make some R bindings - but it would probably still be easier to dump things to shapefiles. – Spacedman Sep 24 '11 at 21:33
  • I'll take a look at Rcpp. I started to look at SWIG, but then my brain started to hurt, so I stopped. – Peter Sep 25 '11 at 01:20