-
Notifications
You must be signed in to change notification settings - Fork 0
/
pmtiles.qmd
65 lines (56 loc) · 1.18 KB
/
pmtiles.qmd
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
57
58
59
60
61
62
63
64
65
---
title: Testing pmtiles
---
```{r}
devtools::load_all(here::here())
library(sf)
```
```{r}
plot(rnet_limerick)
sf::write_sf(rnet_limerick, "rnet_limerick.geojson")
```
Now we'll convert those to `rnet_limerick.pmtiles`:
```bash
tippecanoe -o rnet_limerick.pmtiles -zg rnet_limerick.geojson
```
Now we'll read them back in:
```{r}
library(leafem)
library(leaflet)
url_rivers = "https://vector-tiles-data.s3.eu-central-1.amazonaws.com/rivers_africa.pmtiles"
leaflet() %>%
addTiles() %>%
addPMPolylines(
url = url_rivers
, layerId = "rivers"
, group = "rivers"
, style = paintRules(
layer = "rivers_africa"
, color = "blue"
)
) %>%
setView(24, 2.5, 4)
```
```{r}
f_rivers = basename(url_rivers)
if (!file.exists(f_rivers)) {
download.file(url_rivers, f_rivers)
}
```
```{r}
u_routes = "https://itsleeds.github.io/netvis/rnet_limerick.pmtiles"
f_routes = basename(u_routes)
leaflet() %>%
addTiles() %>%
addPMPolylines(
# url = paste0("pmtiles://", f_rivers)
url = f_routes,
, layerId = "rnet_limerick"
# , group = "rivers"
, style = paintRules(
layer = "rnet_limerick"
, color = "blue"
)
) %>%
setView(-5, 52, 6)
```