Skip to content

Commit

Permalink
Merge pull request #377 from rolfsimoes/hotfix/bbox
Browse files Browse the repository at this point in the history
Hotfix/bbox
  • Loading branch information
rolfsimoes authored Sep 24, 2021
2 parents ca74f87 + d78acc7 commit a02159d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 13 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: sits
Type: Package
Version: 0.14.0-1
Version: 0.14.0-2
Title: Satellite Image Time Series Analysis for Remote Sensing Data Cubes
Authors@R: c(person('Rolf', 'Simoes', role = c('aut'), email = 'rolf.simoes@inpe.br'),
person('Gilberto', 'Camara', role = c('aut', 'cre'), email = 'gilberto.camara@inpe.br'),
Expand Down
8 changes: 5 additions & 3 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@
We are preparing to release the package on CRAN and are making relevant changes in the development version.


# What's new in SITS version 0.14.0-1
# What's new in SITS version 0.14.0

### New features in SITS version 0.14.0-2

* fix `sits_bbox()` function

### New features in SITS version 0.14.0-1

* fix duplicate link in AWS STAC

# What's new in SITS version 0.14.0

### New features in SITS version 0.14.0

* Now the plot of a classified cube requires a legend or a palette if the labels are not in the default sits palette.
Expand Down
22 changes: 13 additions & 9 deletions R/sits_bbox.R
Original file line number Diff line number Diff line change
Expand Up @@ -50,29 +50,33 @@ sits_bbox.cube <- function(data, wgs84 = FALSE, ...) {

# create and return the bounding box
if (nrow(data) == 1) {
bbox <- c(data$xmin, data$xmax, data$ymin, data$ymax)
bbox <- c(xmin = data$xmin,
xmax = data$xmax,
ymin = data$ymin,
ymax = data$ymax)
} else {
bbox <- c(min(data$xmin), max(data$xmax),
min(data$ymin), max(data$ymax)
bbox <- c(xmin = min(data$xmin),
xmax = max(data$xmax),
ymin = min(data$ymin),
ymax = max(data$ymax)
)
}

names(bbox) <- c("xmin", "xmax", "ymin", "ymax")


# convert to WGS84?
if (wgs84) {

bbox <- c(
.sits_proj_to_latlong(x = bbox[["xmin"]],
y = bbox[["ymin"]],
crs = data$crs),
crs = data$crs[[1]]),
.sits_proj_to_latlong(x = bbox[["xmax"]],
y = bbox[["ymax"]],
crs = data$crs)
crs = data$crs[[1]])
)

names(bbox) <- c("lon_min", "lon_max", "lat_min", "lat_max")
names(bbox) <- c("lon_min", "lat_min", "lon_max", "lat_max")

bbox <- bbox[c("lon_min", "lon_max", "lat_min", "lat_max")]
}

return(bbox)
Expand Down

0 comments on commit a02159d

Please sign in to comment.