Learn R Programming

rosm (version 0.3.0)

osm_url_load_async: Load tile URLs

Description

Load tile URLs

Usage

osm_url_load_async(tile, spec, callback = NULL, cache_spec = NULL)

Value

`tile`, invisibly.

Arguments

tile

A `data.frame()` with columns `x`, `y`, and `zoom`.

spec

An [osm_url_spec()]

callback

A function to be run for each tile fetch or NULL to do nothing. The callback is always called with two arguments: the first is the subset of `tile` for which this URL applies (typically one row but can be more than one in some corner cases); the second is the curl response object whose useful elements are url, status_code, type, and content.

cache_spec

An optional [osm_url_spec()] or character vector to be used as the cache.

Examples

Run this code
bounds <- wk::rct(
  252185, 4815826, 739729, 5210280,
  crs = "EPSG:32620"
)

tiles <- osm_tile_covering(bounds, zoom = 5)

osm_url_load_async(
  tiles,
  osm_url_spec_example(),
  function(tile, res) {
    str(tile)
    str(res)
  }
)

Run the code above in your browser using DataLab