library(covr)
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "README-"
)

An R Interface to OpenLayers

Travis-CI Build Status Travis-CI Build Status

OpenLayers is an open-source JavaScript library making it easy to put a dynamic map in any web page. The goal of the openlayers R package is to make this functionality available within R via the htmlwidgets package. Check NEWS file for available functionality.

Installation

You can install openlayers from github with:

# install.packages("devtools")
devtools::install_github("crazycapivara/openlayers")

# latest version
devtools::install_github("crazycapivara/openlayers", ref = "develop")

Examples

Here we go with some basic examples:

library(openlayers)
ol() %>%
  add_stamen_tiles() %>%
  set_view(9.5, 51.31667, zoom = 10)

## Points
library("geojsonio")

cities <- us_cities[1:5, ]

ol()  %>%
  add_stamen_tiles() %>%
  add_features(cities, style = icon_style(),
               popup = cities$name)

## Polygons
library("sf")

nc <- st_read(system.file("gpkg/nc.gpkg", package = "sf"),
             quiet = TRUE)

ol() %>%
  add_stamen_tiles("watercolor") %>%
  add_stamen_tiles(
    "terrain-labels",
    options = layer_options(max_resolution = 13000)
  ) %>%
  add_features(
    data = nc,
    style = fill_style("yellow") + stroke_style("blue", 1),
    popup = nc$AREA  
  ) %>%
  add_overview_map()

Documentation

A detailed documentation of the package is still under development, but all functions are documented, so that you can use the build in help functionality of R. Furthermore, check the example scripts in inst/examples/ to get an idea about how to use this package.

Code coverage

package_coverage()


crazycapivara/openlayersr documentation built on June 4, 2019, 8:08 p.m.