Interactive maps
Besides being able to use Web-services to download map tiles for the background of the maps created in R, we can also rely on some of those to generate truly interactive maps. One of the best known related services is the Google Visualization API, which provides a platform for hosting visualizations made by the community; you can also use it to share maps you've created with others.
Querying Google Maps
In R, you can access this API via the googleVis
package written and maintained by Markus Gesmann and Diego de Castillo. Most functions of the package generate HTML and JavaScript code that we can directly view in a Web browser as an SVG
object with the base
plot function; alternatively, we can integrate them in a Web page, for example via the IFRAME HTML tag.
The gvisIntensityMap
function takes a data.frame
with country ISO or USA state codes and the actual data to create a simple intensity map. We will use the cancels
dataset we created in the Finding Polygon Overlays...