Skip to content

Commit 77d1d2f

Browse files
committed
Add updated osm.qmd
1 parent 3fd04fc commit 77d1d2f

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

osm.qmd

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,47 @@ oe_match(poznan, provider = "openstreetmap_fr")
228228

229229
As shown above, `bbbike` is the only provide that provides a match for Poznan (the others match with all of Poland).
230230

231+
## Downloading the extract
232+
233+
We can download the extract using `oe_get()`, noting the user of `layer = "points"` to get the points layer of the OSM data:
234+
235+
```{r, warning = FALSE, message = FALSE}
236+
#| eval: false
237+
#| echo: false
238+
poznan = oe_get("Poznan", provider = "bbbike", type = "points", force_vectortranslate = TRUE)
239+
# fails with
240+
# The input place was matched with: Poznan
241+
# The chosen file was already detected in the download directory. Skip downloading.
242+
# Starting with the vectortranslate operations on the input file!
243+
# 0...10...20...30...40...50...60...70...80...90...100 - done.
244+
# Finished the vectortranslate operations on the input file!
245+
# Error: Not compatible with requested type: [type=character; target=double].
246+
```
247+
248+
```{r}
249+
poznan = oe_get("Poznan", provider = "bbbike", force_vectortranslate = TRUE)
250+
```
251+
252+
Note: that takes quite a while download, so we will use a smaller extract for the rest of the session:
253+
254+
```{r, warning = FALSE, message = FALSE}
255+
#| eval: false
256+
# ?oe_get
257+
malta_osm_lines = oe_get("malta", provider = "bbbike", type = "lines")
258+
malta_osm_mlines = oe_get("malta", provider = "bbbike", type = "multilinestrings")
259+
malta_osm_polygons = oe_get("malta", provider = "bbbike", type = "mutlipolygons")
260+
malta_osm_other = oe_get("malta", provider = "bbbike", type = "other_relations")
261+
```
262+
263+
Let's take a look at the size of each layer, in units of MB:
264+
265+
```{r}
266+
#| code-fold: true
267+
#| eval: false
268+
sapply(list(malta_osm_points, malta_osm_lines, malta_osm_mlines, malta_osm_polygons, malta_osm_other), function(x) {
269+
round(object.size(x) / 1e6, 1)
270+
})
271+
```
231272

232273
# Other command line tools for working with OSM data {#sec-command-line}
233274

0 commit comments

Comments
 (0)