maps with leafletr

8
@MicheleTobias @GeospatialUCD Maps with leafletR Michele M. Tobias, PhD Feb. 20 th , 2015 ▪ UC Davis R Users Group

Upload: michele-tobias

Post on 17-Jul-2015

1.696 views

Category:

Data & Analytics


0 download

TRANSCRIPT

Page 1: Maps with leafletR

@MicheleTobias @GeospatialUCD

Maps with leafletR

Michele M. Tobias, PhD

Feb. 20th, 2015 ▪ UC Davis R Users Group

Page 2: Maps with leafletR

@MicheleTobias @GeospatialUCD

What is Leaflet?

Javascript library

Used in web pages

Makes interactive web maps

Example: http://micheletobias.github.io/maps/DistributionsMap.html

Page 3: Maps with leafletR

@MicheleTobias @GeospatialUCD

What is leafletR?

Package for R

User enters commands into an R terminal

Generates Leaflet javascript commands for you

Output is an HTML document that can be viewed in a web browser

Page 4: Maps with leafletR

@MicheleTobias @GeospatialUCD

Some Simple Code:

library(leafletR)

m <- leaflet()m

Produces

Page 5: Maps with leafletR

@MicheleTobias @GeospatialUCD

A more complex example...

(switch to R)

Page 6: Maps with leafletR

@MicheleTobias @GeospatialUCD

Data Types

GeoJSONTopoJSON

Conversion tools available in the packageGenerally requires columns for Lat & Long

Page 7: Maps with leafletR

@MicheleTobias @GeospatialUCD

Concerns

Default Projection = Web Mercator

Not designed for use in print publications

Terms of Service for base maps used

Page 8: Maps with leafletR

@MicheleTobias @GeospatialUCD

TutorialsLeafletR Documentation: http://cran.r-project.org/web/packages/leafletR/leafletR.pdfHTML & Javascript: http://www.w3schools.com/

Leaflet: http://leafletjs.com/examples.html

Related but different package: Leaflet for R http://rstudio.github.io/leaflet/