-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.Rmd
39 lines (33 loc) · 1.45 KB
/
README.Rmd
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
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r setup, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
)
```
# tiles
```{r}
# devtools::install_github("ropensci/osmdata")
library(osmdata)
library(raster)
library(tiler)
bb = getbb("Accra")
ex = extent(bb)
r = raster(ex, nrows = 100, ncols = 100)
values(r) = rep(1:100, 100)
plot(r)
writeRaster(r, "r.tif", overwrite = TRUE)
system("gdal2tiles.py -s EPSG:4326 -z 2-14 r.tif accra")
browseURL("accra/leaflet.html")
```
```{r}
library("leaflet")
leaflet() %>%
setView(0, 5, zoom = 9) %>%
# addTiles() %>%
addTiles(urlTemplate = "http://ATFutures.github.io/tiles/accra/{z}/{x}/{y}.png",
options = tileOptions(minZoom = 15, maxZoom = 18, tms = TRUE))
```