Build Status

mapit is an R package designed to assist in mapping tasks. Its prominent tool is the wrapper for the Texas A & M Geoservices that provides R based geocoding. Users can sign up for an API key HERE.


To download the development version of mapit:

Download the zip ball or tar ball, decompress and run R CMD INSTALL on it, or use the devtools package to install the development version:

library(knitr); library(ggmap); library(mapit)

opts_chunk$set(cache=FALSE, tidy=FALSE, warning=FALSE,  fig.path='inst/readme/figure/')

## knitr::knit2html("README.Rmd")
# install.packages("devtools")

install_github("mapit", "trinker")

Note: Windows users need Rtools and devtools to install this way.

Note: Mac users might be required to install the appropriate version XTools from the Apple Developer site in order to install the development version. You may need to register as an Apple developer. An older version of XTools may also be required.


Package PDF Help Manual


You are welcome to: submit suggestions and bug-reports at: send a pull request on: * compose a friendly e-mail to: [email protected]

bounding_box Function

This is an R implementation of Jan Philip Matuschek's bounding box article: Finding Points Within a Distance of a Latitude/Longitude Using Bounding Coordinates.

So here we can look at the area within one square mile of the White House:

bounding_box(38.89768, -77.03653, 1)

Let's apply it. Here's an example plotting a bounding box around the 2012 Olympic Stadium:

library(ggplot2); library(ggmap)

bb <- bounding_box(lon = -0.016179, lat = 51.538525, 1)

mapImageData <- get_map(location = c(lon = -0.016179, lat = 51.538525),
    color = "color",
    source = "google",
    maptype = "hybrid",
    zoom = 14)

    extent = "device",
    ylab = "Latitude",
    xlab = "Longitude") + 
    geom_rect(aes(xmin = bb[1, 1], xmax = bb[1, 2], ymin = bb[2, 1], 
        ymax = bb[2, 2]), color="red", fill=NA, size=2) +
    geom_point(data=data.frame(lon = -0.016179, lat = 51.538525), size=7, 

trinker/mapit documentation built on May 27, 2017, 1:49 p.m.