Skip to content

Commit

Permalink
Merge pull request #12 from ctoney/gdalraster_output
Browse files Browse the repository at this point in the history
support gdalraster output as vector
  • Loading branch information
mdsumner committed Feb 14, 2024
2 parents daeff30 + 4261072 commit 949cbf2
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions R/ximage.R
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,16 @@ ximage.default <- function(x, extent = NULL, zlim = NULL, add = FALSE, ..., xlab
ximage.list(x, extent = extent, zlim = zlim, add = add, ..., xlab = xlab, ylab = ylab, col = col)
return(invisible(x))
}

if (is.numeric(x) && "gis" %in% names(attributes(x))) {
## vector output from gdalraster
gis <- attr(x, "gis")
x_list <- asplit(array(x, dim = gis$dim), MARGIN=3)
attr(x_list, "gis") <- gis
ximage.list(x_list, extent = extent, zlim = zlim, add = add, ..., xlab = xlab, ylab = ylab, col = col)
return(invisible(x_list))
}

stopifnot(inherits(x, "array"))

if (is.raw(x)) {
Expand Down

0 comments on commit 949cbf2

Please sign in to comment.