Showing 1 of 1 files from the diff.

@@ -1091,11 +1091,22 @@
Loading
1091 1091
    if (is(studyArea, "Spatial"))
1092 1092
      studyArea <- sf::st_as_sf(studyArea)
1093 1093
1094 +
    xOrigCRS <- sf::st_crs(x)
1095 +
    changedCRS <- FALSE
1096 +
    isXLongLat <- sf::st_is_longlat(x)
1094 1097
    messagePrepInputs("maskInputs with sf class objects is still experimental", verbose = verbose)
1095 1098
    messagePrepInputs("    intersecting ...", verbose = verbose, verboseLevel = 0)
1096 1099
    #studyArea <- raster::aggregate(studyArea, dissolve = TRUE)
1097 -
    if (!identical(sf::st_crs(x), sf::st_crs(studyArea)))
1098 -
      studyArea <- sf::st_transform(studyArea, crs = sf::st_crs(x))
1100 +
    if (!identical(xOrigCRS, sf::st_crs(studyArea))) {
1101 +
      if (isXLongLat) {
1102 +
        changedCRS <- TRUE
1103 +
        x <- sf::st_transform(x, crs = sf::st_crs(studyArea))
1104 +
      } else {
1105 +
        studyArea <- sf::st_transform(studyArea, crs = xOrigCRS)
1106 +
      }
1107 +
1108 +
    }
1109 +
1099 1110
    if (NROW(studyArea) > 1) {
1100 1111
      studyArea <- sf::st_sf(sf::st_combine(studyArea))
1101 1112
    }
@@ -1109,13 +1120,17 @@
Loading
1109 1120
      studyArea <- fixErrors(studyArea)
1110 1121
      y <- sf::st_intersection(x, studyArea)
1111 1122
      ## fixErrors doesn't work with multiple geometries; st_buffer does, so use it here
1112 -
      y <- suppressWarningsSpecific(sf::st_buffer(y, 0),
1113 -
                                    "st_buffer does not correctly buffer longitude/latitude data")
1123 +
      y <- fixErrors(y)
1124 +
      #y <- suppressWarningsSpecific(sf::st_buffer(y, 0),
1125 +
      #                              "st_buffer does not correctly buffer longitude/latitude data")
1114 1126
    }
1115 1127
    if (!identical(.crs(y), .crs(x))) {
1116 1128
      ## sometimes the proj4string is rearranged, so they are not identical; they should be
1117 1129
      crs(y) <- .crs(x)
1118 1130
    }
1131 +
    if (changedCRS) {
1132 +
      y <- sf::st_transform(y, xOrigCRS)
1133 +
    }
1119 1134
1120 1135
    return(y)
1121 1136
  } else {
Files Coverage
R 65.71%
Project Totals (25 files) 65.71%
1
comment: false
2

3
coverage:
4
  status:
5
    project:
6
      default:
7
        target: auto
8
        threshold: 1%
9
        informational: true
10
    patch:
11
      default:
12
        target: auto
13
        threshold: 1%
14
        informational: true
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading