ggspatial (version 0.2.1)

stat_project: Statisitc to project coordinates

Description

Projects coordinates using rgdal/sp. Takes params crsfrom and crsto, both wrapped in as.CRS, such that you can pass an epsg code, a CRS object or NA to guess the input (will be either lat/lon or google mercator). If NA, crsto is assumed to be EPSG:4326 (Lat/Lon), so data can be used with coord_map.

Usage

stat_project(mapping = NULL, data = NULL, crsfrom = NA, crsto = NA,
  position = "identity", show.legend = TRUE, inherit.aes = TRUE,
  geom = "point", ...)

Arguments

mapping

A mapping as created by aes() or aes_string()

data

A Spatial* object or data.frame.

crsfrom

An object that can be coerced to a CRS using as.CRS; defaults to the CRS of the data or lat/lon if that does not exist

crsto

An object that can be coerced to a CRS using as.CRS; defaults to lat/lon so that the plot can be projected using coord_map()

position

Passed on to geom_*

show.legend

Logical describing the legend visibility.

inherit.aes

Logical describing if aesthetics are inherited

geom

For data frames, the geometry to use

...

Passed to the geom

Examples

Run this code
# NOT RUN {
# longlake roads df is in UTM zone 20 (epsg:26920)
ggplot(longlake_roadsdf, aes(long, lat)) +
  stat_project(geom = "path", crsfrom = 26920) +
  coord_map()

# }

Run the code above in your browser using DataLab