smap {smartmap}R Documentation

View spatial objects as interactive leaflet maps

Description

Can be used to preview spatial R objects

Usage

smap(
  x,
  ...,
  tools = TRUE,
  provider = getOption("smap.providers", "OpenStreetMap")
)

## S3 method for class 'leaflet'
smap(
  x,
  ...,
  tools = TRUE,
  provider = getOption("smap.providers", "OpenStreetMap")
)

## S3 method for class 'sf'
smap(
  x,
  ...,
  tools = TRUE,
  provider = getOption("smap.providers", "OpenStreetMap")
)

## Default S3 method:
smap(
  x,
  labels = NULL,
  ...,
  tools = TRUE,
  provider = getOption("smap.providers", "OpenStreetMap")
)

## S3 method for class 'sfc'
smap(
  x,
  ...,
  tools = TRUE,
  provider = getOption("smap.providers", "OpenStreetMap")
)

## S3 method for class 'sfg'
smap(
  x,
  ...,
  tools = TRUE,
  provider = getOption("smap.providers", "OpenStreetMap")
)

## S3 method for class 'matrix'
smap(
  x,
  labels = NULL,
  ...,
  tools = TRUE,
  provider = getOption("smap.providers", "OpenStreetMap")
)

Arguments

x

any input supported by smart_as_sf() or a leaflet map

  • a matrix: Either a matrix with named longitude and latitude columns or an unnamed two column matrix containing longitude and latitude (in that order)

  • a data.frame with named longitude and latitude columns

  • an sf::sfc_POINT object

  • a named or unnamed numeric vector of length 2 containing a single longitude-latitude coordinate pair

  • a character scalar path or URL to a shapefile or zipped shapefile

  • a leaflet map

...

passed on to methods.

tools

logical scalar. If TRUE show additional tools on the resulting map (such as a ruler and the ability to switch between several background tiles)

provider

character vector. Name of one or several valid providers for leaflet::addProviderTiles(). If tools == TRUE you will be able to switch interactively between all supplied providers on the returned leaflet map, if tools == FALSE only the first provider will be used.

labels

an optional character vector of popup labels

Value

a leaflet::leaflet object

Examples

wp <- matrix(
  c(16.419684, 48.186065,
    16.373894, 48.207853,
    16.285887, 48.083053),
  byrow = TRUE,
  ncol = 2
)


smap(wp)
smap(c(16.419684, 48.186065))


[Package smartmap version 0.1.1 Index]