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
  • #44
Closed
Open
Issue created May 23, 2020 by Facundo Muñoz@famuvie®️Owner

Handle network data with nodes outside the territory

mapMCDA currently fails when a node falls outside the territory.

MRE:

library(mapMCDA)
library(sp)
cmr <- mapMCDA_datasets()

## Correct behaviour, when all nodes are within the territory
risk_layer(
  cmr$mobility,
  boundaries = cmr$cmr_admin3
)
#> class      : RasterLayer 
#> dimensions : 100, 67, 6700  (nrow, ncol, ncell)
#> resolution : 0.1142512, 0.1142512  (x, y)
#> extent     : 8.499454, 16.15429, 1.652267, 13.07739  (xmin, xmax, ymin, ymax)
#> crs        : +proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0 
#> source     : memory
#> names      : layer 
#> values     : 0, 100  (min, max)

## Move one node outside of the national territory
cmr_nodes <- attr(cmr$mobility, "geom_node")
cmr_nodes[4] <- cmr_nodes[4] - 1
attr(cmr$mobility, "geom_node") <- cmr_nodes

plot(cmr$cmr_admin3, border = "darkgray")
plot(cmr$mobility, add = TRUE)


## Failure
risk_layer(
  cmr$mobility,
  boundaries = cmr$cmr_admin3
)
#> nerror = 16
#> Error in deldir::tile.list(z): Argument "object" is not of class "deldir".

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

Expected behaviour

mapMCDA should automatically filter (with a warning) the part of the network within borders, and proceed from there.

Assignee
Assign to
Time tracking