Code Monkey home page Code Monkey logo

demo-geospatial-targets's Introduction

demo-geospatial-targets

This repository has been created to demonstrate some of the issues around using geospatial data with targets.

In particular, I cannot work out how to implement saving a shapefile in targets.

The recommendations in ropensci/targets#1238 provided a solution for rasters, but a similar solution, implemented in format_shapefile did not seem to work:

format_shapefile <- tar_format(
  read = function(path) terra::vect(path),
  write = function(object, path) {
    terra::writeVector(
      x = object,
      filename = path,
      filetype = "ESRI Shapefile",
      overwrite = TRUE
    )
  },
  marshal = function(object) terra::wrap(object),
  unmarshal = function(object) terra::unwrap(object)
)

I got the error:

tar_make(example_shapefile)
terra 1.7.55
▶ start target example_shapefile
● built target example_shapefile [0.013 seconds]
Error:
! Error running targets::tar_make()
  Error messages: targets::tar_meta(fields = error, complete_only = TRUE)
  Debugging guide: https://books.ropensci.org/targets/debugging.html
  How to ask for help: https://books.ropensci.org/targets/help.html
  Last error: the write() function in tar_format() must not create a directory. Found directories inside the data store where there should only be files: _targets/objects/example_shapefile

I also get the same error when I run

tar_make(example_gadm)
Loading required package: terra
terra 1.7.55
▶ start target country_codes
● built target country_codes [0.004 seconds]
▶ start target example_gadm
✖ error target example_gadm
Error:
! Error running targets::tar_make()
  Error messages: targets::tar_meta(fields = error, complete_only = TRUE)
  Debugging guide: https://books.ropensci.org/targets/debugging.html
  How to ask for help: https://books.ropensci.org/targets/help.html
  Last error: the write() function in tar_format() must not create a directory. Found directories inside the data store where there should only be files: _targets/objects/example_shapefile

demo-geospatial-targets's People

Contributors

brownag avatar njtierney avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.