Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • mapMCDA mapMCDA
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 31
    • Issues 31
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • UMR-ASTREUMR-ASTRE
  • mapMCDAmapMCDA
  • Issues
  • #47
Closed
Open
Issue created May 29, 2020 by Facundo Muñoz@famuvie®️Owner

Rasterise a network with all nodes beyond boundaries: give informative error.

This is a common mistake, for example when data contains switched coordinates. However, the error message is unhelpful.

MRE:

library(mapMCDA)
library(raster)
#> Loading required package: sp
r <- raster(nrow = 10, ncol = 10, xmn = 0, xmx = 10, ymn = 0, ymx = 10, vals = 1)

## A geonetwork with all nodes beyond boundaries
## A -> B; A -> C; A -> D
edges <- data.frame(
  O = rep("A", 3),
  D = LETTERS[2:4],
  stringsAsFactors = FALSE
)
nodes <- data.frame(
  node = LETTERS[1:4],
  x = rep(c(-2, 12), times = 2),
  y = c(2, 2, 11, 8)
)
gn <- geonetwork::geonetwork(edges, nodes)

plot(1, xlim = c(-5, 15), ylim = c(-5, 15), type = "n")
plot(r, add = TRUE, legend = FALSE)
plot(gn, add = TRUE)


rasterize(gn, r)
#> Point being added:
#> [1] 2
#> Error in deldir::deldir(xy[, 1], xy[, 2], rw = ext, eps = eps, suppressMsge = TRUE): Cannot find an enclosing triangle.  See help for deldir.

Created on 2020-05-29 by the reprex package (v0.3.0)

Expected behaviour: Identify the error and provide an informative message for the user.

Assignee
Assign to
Time tracking