Skip to content

Commit 6355d8d

Browse files
committed
Add table with n features and sizes
1 parent 0c97780 commit 6355d8d

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

osm.qmd

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,9 @@ monaco_osm_points = oe_get("monaco", provider = "bbbike", layer = "points")
265265
266266
```
267267

268-
```{r, warning = FALSE, message = FALSE}
268+
```{r}
269+
#| message: false
270+
#| results: "hide"
269271
# ?oe_get
270272
monaco_osm_lines = oe_get("monaco", provider = "bbbike", layer = "lines", skip_vectortranslate = TRUE)
271273
f = list.files(oe_download_directory(), pattern = "monaco", full.names = TRUE)
@@ -279,9 +281,19 @@ monaco_osm_other = oe_get("monaco", provider = "bbbike", layer = "other_relation
279281
Let's take a look at the size of each layer, in units of MB:
280282

281283
```{r}
282-
sapply(list(monaco_osm_points, monaco_osm_lines, monaco_osm_mlines, monaco_osm_polygons, monaco_osm_other), function(x) {
284+
#| code-fold: true
285+
sizes_mb = sapply(list(monaco_osm_points, monaco_osm_lines, monaco_osm_mlines, monaco_osm_polygons, monaco_osm_other), function(x) {
283286
round(object.size(x) / 1e6, 1)
284287
})
288+
layer_names = c("points", "lines", "multilinestrings", "multipolygons", "other_relations")
289+
n_features = sapply(list(monaco_osm_points, monaco_osm_lines, monaco_osm_mlines, monaco_osm_polygons, monaco_osm_other), nrow)
290+
size_df = data.frame(
291+
layer = layer_names,
292+
size_mb = sizes_mb,
293+
n_features = n_features,
294+
kb_per_feature = sizes_mb / n_features * 1e3
295+
)
296+
knitr::kable(size_df)
285297
```
286298

287299

0 commit comments

Comments
 (0)