map_leaflet: Make an interactive map to view in the browser

Description Usage Arguments Details Examples

Description

Make an interactive map to view in the browser

Usage

1
2
3
map_leaflet(dat, popup = TRUE, map_provider = "osm", zoom = 3,
  title = "map", size, centerview = c(30, -73.9), dest = ".",
  overwrite = TRUE, incl.data = TRUE)

Arguments

dat

Object of class occdat as returned by occ.

popup

If TRUE (default) popup tooltips are created for each point with metadta for that point.

map_provider

Base map to use. One or a list of 'osm' (OpenStreetMap standard map), 'tls' (Thunderforest Landscape), 'cm' (CloudMade), 'mqosm' (MapQuest OSM) or 'mqsat' (MapQuest Open Aerial). Default is 'osm'. See leaflet for more information.

zoom

Map zoom, 0 being most zoomed out, and 18 most zoomed out. See leaflet for more information.

title

Map title

size

Height and width (in pixels) of map as a length 2 vector. If missing, a fullscreen (browser window) map is generated.

centerview

Lat/long position to center map

dest

Specify a path to save an html file of your map. You can open this in your browser to view it. If left as NULL (the default) the map opens up in your default browser, or if you have a newer version of RStudio open in RStudio Viewer pane.

overwrite

Default: TRUE. Set to FALSE to prevent overwriting local files

incl.data

Default: TRUE. Writes geoJSON data into the html file to get around security restrictions in browsers like Google Chrome. Set to FALSE to read from a separate local geoJSON file.

Details

NOTE that with some map_provider options you will have no map layer show up at first. This may be because there is no map at that particular zoom level. Just zoom in or out to see the map.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## Not run: 
library("spocc")
spp <- c('Danaus plexippus','Accipiter striatus','Pinus contorta')
dat <- occ(query = spp, from = 'gbif', gbifopts = list(hasCoordinate = TRUE), limit=50)
map_leaflet(dat, dest = ".")

# An example with more species, a different base map, and different color palette
spp <- c('Danaus plexippus','Accipiter striatus','Pinus contorta','Puma concolor',
'Ursus americanus','Gymnogyps californianus')
dat <- occ(query = spp, from = 'gbif', gbifopts = list(hasCoordinate = TRUE), limit=50)
map_leaflet(dat, map_provider = 'toner')

## End(Not run)

spoccutils documentation built on Sept. 12, 2016, 10:35 a.m.