smap: View spatial objects as interactive leaflet maps

Description Usage Arguments Value Examples

View source: R/smap.R

Description

Can be used to preview spatial R objects

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
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))

s-fleck/quickmap documentation built on July 10, 2021, 6:55 a.m.