Skip to content

Error reading downloaded kml file using sf st_layers and st_read #514

Open
@psychemedia

Description

@psychemedia

Notwithstanding closed issue #169 (reading from sf system package), I am seeing the following error trying to read a downloaded kml file. The code runs as expected in a "full" R environment.

library(sf)
url <- 'https://webapps2.wrc.com/2020/web/live/kml/montecarlo_2021.xml'
download_kml <- function(kml_url, tmp_dir = tempdir() ) {
    tmpfile <- tempfile(tmpdir = tmp_dir, fileext = ".kml")
    download.file( kml_url, tmpfile)
     tmpfile
  }
tmp <- download_kml(url)
st_read(tmp)

Returns:

Error evaluating OJS cell
viewof _webr_editor_1 = {
  const { WebRExerciseEditor, b64Decode } = window._exercise_ojs_runtime;
  const scriptContent = document.querySelector(`script[type=\"webr-1-contents\"]`).textContent;
  const block = JSON.parse(b64Decode(scriptContent));

  const options = Object.assign({ id: `webr-1-contents` }, block.attr);
  const editor = new WebRExerciseEditor(webROjs.webRPromise, block.code, options);

  return editor.container;
}
_webr_value_1 = webROjs.process(_webr_editor_1, {});

TypeError: Cannot read properties of undefined (reading 'apply')
rejected @ quarto-ojs-runtime.js:5431
variable_rejected @ quarto-ojs-runtime.js:4133
(anonymous) @ quarto-ojs-runtime.js:4577
Promise.then
variable_compute @ quarto-ojs-runtime.js:4571
runtime_computeNow @ quarto-ojs-runtime.js:4440
(anonymous) @ quarto-ojs-runtime.js:4377
Promise.then
runtime_computeSoon @ quarto-ojs-runtime.js:4377
runtime_compute @ quarto-ojs-runtime.js:4373
postcompute @ quarto-ojs-runtime.js:4619
(anonymous) @ quarto-ojs-runtime.js:4602
Promise.then
(anonymous) @ quarto-ojs-runtime.js:4590
Promise.then
compute @ quarto-ojs-runtime.js:4589
recompute @ quarto-ojs-runtime.js:4599
runtime_computeNow @ quarto-ojs-runtime.js:4390
(anonymous) @ quarto-ojs-runtime.js:4377
Promise.then
runtime_computeSoon @ quarto-ojs-runtime.js:4377
runtime_compute @ quarto-ojs-runtime.js:4373
runtime_precompute @ quarto-ojs-runtime.js:4369
(anonymous) @ quarto-ojs-runtime.js:4602
Promise.then
(anonymous) @ quarto-ojs-runtime.js:4602
Promise.then
(anonymous) @ quarto-ojs-runtime.js:4590
Promise.then
compute @ quarto-ojs-runtime.js:4589
recompute @ quarto-ojs-runtime.js:4599
runtime_computeNow @ quarto-ojs-runtime.js:4390
(anonymous) @ quarto-ojs-runtime.js:4377
Promise.then
runtime_computeSoon @ quarto-ojs-runtime.js:4377
runtime_compute @ quarto-ojs-runtime.js:4373
runtime_precompute @ quarto-ojs-runtime.js:4369
(anonymous) @ quarto-ojs-runtime.js:4602
Promise.then
(anonymous) @ quarto-ojs-runtime.js:4602

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions