Skip to content

Commit 9ac126d

Browse files
authored
use docs folder for docs instead of gh-pages (#8)
* copy over gh-pages into docs folder * use usa_sf instead of usa_composite > rmapshaper::ms_simplify(usa_composite()) Error in ogrInfo(dsn = dsn, layer = layer, encoding = encoding, use_iconv = use_iconv, : Cannot open data source No errors when using `usa_sf()` * compile docs * Add note to where data came from (#498) Will be true once branch is merged into master * Add docs for input$MAPID_center from @michael-chong for (#450) had to copy verbatim as the website moved from gh-pages to docs folder
1 parent c9ce195 commit 9ac126d

File tree

281 files changed

+156283
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

281 files changed

+156283
-0
lines changed

docs/.Rprofile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
library(leaflet)
2+
set.seed(0102)
3+
knitr::opts_chunk$set(out.width = '100%')

docs/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.Rproj.user
2+
.Rhistory
3+
.RData

docs/.nojekyll

Whitespace-only changes.

docs/Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
HTML_FILES := $(patsubst %.Rmd, %.html ,$(wildcard *.Rmd)) \
2+
$(patsubst %.Rmd, %.html ,$(wildcard examples/*.Rmd)) \
3+
$(patsubst %.md, %.html ,$(wildcard *.md))
4+
5+
all: html
6+
7+
8+
html: $(HTML_FILES)
9+
10+
%.html: %.Rmd _includes/* _output.yaml
11+
Rscript compile.R "$<"
12+
13+
%.html: %.md
14+
Rscript compile.R "$<"
15+
16+
.PHONY: clean
17+
clean:
18+
$(RM) $(HTML_FILES)
19+
$(RM) -r libs examples/libs
20+

docs/_includes/after_body.html

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<footer>
2+
<p><small>The "leaflet" R package is copyright &copy; 2014-2016 RStudio, Inc.<br/>
3+
The Leaflet JavaScript library is &copy; 2010–2016 <a href="http://agafonkin.com/en">Vladimir Agafonkin</a>, 2010–2011 <a href="http://cloudmade.com">CloudMade</a>.<br/>
4+
Maps &copy; <a href="http://openstreetmap.org/copyright">OpenStreetMap</a> contributors unless otherwise noted.
5+
</small></p>
6+
</footer>
7+
8+
</div>
9+
</div>
10+
11+
<a href="https://github.com/rstudio/leaflet"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://camo.githubusercontent.com/38ef81f8aca64bb9a64448d0d70f1308ef5341ab/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6461726b626c75655f3132313632312e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png"></a>

docs/_includes/before_body.html

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
<style type="text/css">
2+
body {
3+
padding-top: 20px;
4+
}
5+
.navbar-brand {
6+
font-weight: bold;
7+
}
8+
footer {
9+
border-top: 1px solid #CCC;
10+
margin-top: 60px;
11+
margin-bottom: 48px;
12+
opacity: 0.75;
13+
}
14+
.content-body>:first-child, .content-body>:first-child>:first-child {
15+
margin-top: 0 !important;
16+
}
17+
p code {
18+
white-space: inherit;
19+
}
20+
.leaflet-container {
21+
margin: 0 0 10.5px;
22+
}
23+
</style>
24+
25+
<div class="fluid-row">
26+
<div class="col-sm-12">
27+
<nav class="navbar navbar-inverse">
28+
<div class="container-fluid">
29+
<!-- Brand and toggle get grouped for better mobile display -->
30+
<div class="navbar-header">
31+
<a class="navbar-brand" href="./">Leaflet for R</a>
32+
</div>
33+
</div>
34+
</nav>
35+
</div>
36+
</div>
37+
38+
<div class="fluid-row">
39+
<div class="col-sm-3">
40+
<div class="list-group">
41+
<a class="list-group-item" href="./">Introduction</a>
42+
<a class="list-group-item" href="map_widget.html">The Map Widget</a>
43+
<a class="list-group-item" href="basemaps.html">Basemaps</a>
44+
<a class="list-group-item" href="markers.html">Markers</a>
45+
<a class="list-group-item" href="popups.html">Popups and Labels</a>
46+
<a class="list-group-item" href="shapes.html">Lines and Shapes</a>
47+
<a class="list-group-item" href="json.html">GeoJSON and TopoJSON</a>
48+
<a class="list-group-item" href="raster.html">Raster Images</a>
49+
<a class="list-group-item" href="shiny.html">Shiny Integration</a>
50+
<a class="list-group-item" href="colors.html">Colors</a>
51+
<a class="list-group-item" href="legends.html">Legends</a>
52+
<a class="list-group-item" href="showhide.html">Show/Hide Layers</a>
53+
<a class="list-group-item" href="choropleths.html">Choropleths</a>
54+
<a class="list-group-item" href="projections.html">Projections</a>
55+
<a class="list-group-item" href="morefeatures.html">Additional Features</a>
56+
</div>
57+
<script>
58+
// manage active state of toc based on current page
59+
var href = window.location.pathname;
60+
href = href.substr(href.lastIndexOf('/') + 1);
61+
if (href === "" || href === "index.html")
62+
href = "./";
63+
$('a.list-group-item[href="' + href + '"]').addClass('active');
64+
</script>
65+
</div>
66+
<div class="col-sm-9 content-body">

docs/_output.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
html_document:
2+
theme: flatly
3+
self_contained: no
4+
lib_dir: libs
5+
fig_width: 5.5
6+
fig_height: 2.25
7+
fig_retina: 1
8+
includes:
9+
before_body: _includes/before_body.html
10+
after_body: _includes/after_body.html

docs/basemaps.Rmd

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
---
2+
pagetitle: Leaflet for R - Using Basemaps
3+
---
4+
5+
## Using Basemaps
6+
7+
Leaflet supports basemaps using [map tiles](https://www.mapbox.com/guides/how-web-maps-work/), popularized by Google Maps and now used by nearly all interactive web maps.
8+
9+
### Default (OpenStreetMap) Tiles
10+
11+
The easiest way to add tiles is by calling `addTiles()` with no arguments; by default, [OpenStreetMap](https://www.openstreetmap.org/) tiles are used.
12+
13+
```{r fig.height=2.5}
14+
m <- leaflet() %>% setView(lng = -71.0589, lat = 42.3601, zoom = 12)
15+
m %>% addTiles()
16+
```
17+
18+
### Third-Party Tiles
19+
20+
Alternatively, many popular free third-party basemaps can be added using the `addProviderTiles()` function, which is implemented using the [leaflet-providers plugin](https://github.com/leaflet-extras/leaflet-providers). See [here](http://leaflet-extras.github.io/leaflet-providers/preview/index.html) for the complete set.
21+
22+
As a convenience, leaflet also provides a named list of all the third-party tile providers that are supported by the plugin. This enables you to use auto-completion feature of your favorite R IDE (like RStudio) and not have to remember or look up supported tile providers; just type `providers$` and choose from one of the options. You can also use `names(providers)` to view all of the options.
23+
24+
```{r fig.height=1.25}
25+
m %>% addProviderTiles(providers$Stamen.Toner)
26+
m %>% addProviderTiles(providers$CartoDB.Positron)
27+
m %>% addProviderTiles(providers$Esri.NatGeoWorldMap)
28+
```
29+
30+
Note that some tile set providers require you to register; see the [project page](https://github.com/leaflet-extras/leaflet-providers) for more information. You can pass access tokens/keys, and other options, to the tile provider by populating the `options` argument with the `providerTileOptions()` function.
31+
32+
### Custom Tile URL Template
33+
34+
If you happen to have a custom map tile URL template to use, you can provide it as an argument to `addTiles()`.
35+
36+
### WMS Tiles
37+
38+
You can use `addWMSTiles()` to add WMS (Web Map Service) tiles. The map below shows the Base Reflectivity (a measure of the intensity of precipitation occurring) using the WMS from the [Iowa Environmental Mesonet ](http://mesonet.agron.iastate.edu):
39+
40+
```{r fig.height=2.5}
41+
leaflet() %>% addTiles() %>% setView(-93.65, 42.0285, zoom = 4) %>%
42+
addWMSTiles(
43+
"http://mesonet.agron.iastate.edu/cgi-bin/wms/nexrad/n0r.cgi",
44+
layers = "nexrad-n0r-900913",
45+
options = WMSTileOptions(format = "image/png", transparent = TRUE),
46+
attribution = "Weather data © 2012 IEM Nexrad"
47+
)
48+
```
49+
50+
### Combining Tile Layers
51+
52+
You aren't restricted to using a single basemap on a map; you can stack them by adding multiple tile layers. This generally only makes sense if the front tiles consist of semi transparent tiles, or have an adjusted opacity via the `options` argument.
53+
54+
```{r fig.height=1.75}
55+
m %>% addProviderTiles(providers$MtbMap) %>%
56+
addProviderTiles(providers$Stamen.TonerLines,
57+
options = providerTileOptions(opacity = 0.35)) %>%
58+
addProviderTiles(providers$Stamen.TonerLabels)
59+
```

0 commit comments

Comments
 (0)