Skip to content

Commit 8070327

Browse files
committed
check fixes
1 parent 9aaf5a4 commit 8070327

File tree

8 files changed

+27
-17
lines changed

8 files changed

+27
-17
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: vapour
22
Title: Access to the 'Geospatial Data Abstraction Library' ('GDAL')
3-
Version: 0.11.0.9001
3+
Version: 0.12.0
44
Authors@R: c(person("Michael", "Sumner", email = "[email protected]", role = c("aut", "cre"), comment = c(ORCID = "0000-0002-2471-7511")),
55
person("Simon", "Wotherspoon", role = "ctb", comment = "RasterIO configuration for resampling options"),
66
person("Mark", "Padgham", role = "ctb", comment = "helped get started :)"),

NEWS.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
# vapour dev
1+
# vapour 0.12.0
2+
3+
* Fixed a number of unused variable warnings, found from mac_release test on CRAN.
4+
5+
* Removed test that guarded for 0x0 output from GDAL, thanks to CRAN.
26

37
* Stream reading now restored.
48

cran-comments.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11

2-
## vapour 0.11.0
2+
## vapour 0.12.0
33

4-
Fixed bashisms, thanks!
4+
Fixed failing test that simply indicated older GDAL behaviour. s

inst/WORDLIST

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ sds
228228
sp
229229
spatstat
230230
sql
231+
sqlite
231232
src
232233
srs
233234
sst

inst/include/gdalarrowstream/gdalvectorstream.h

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,6 @@ inline Rcpp::List ogr_layer_setup(Rcpp::CharacterVector datasource,
149149
OGRPolygon poly;
150150
OGRLinearRing ring;
151151

152-
// set spatial filter?
153-
bool use_extent_filter = false;
154152
if (ex.length() == 4) {
155153
if (ex[1] <= ex[0] || ex[3] <= ex[2]) {
156154
if (ex[1] <= ex[0]) {
@@ -160,7 +158,6 @@ inline Rcpp::List ogr_layer_setup(Rcpp::CharacterVector datasource,
160158
Rcpp::warning("extent filter invalid (ymax <= ymin), ignoring");
161159
}
162160
} else {
163-
use_extent_filter = true;
164161
ring.addPoint(ex[0], ex[2]); //xmin, ymin
165162
ring.addPoint(ex[0], ex[3]); //xmin, ymax
166163
ring.addPoint(ex[1], ex[3]); //xmax, ymax
@@ -236,13 +233,14 @@ inline Rcpp::List read_gdal_stream(
236233
drivers,
237234
extent,
238235
width);
239-
OGRDataSource* poDS = (OGRDataSource*)(R_ExternalPtrAddr(prep[0]));
236+
240237
OGRLayer* poLayer = (OGRLayer*)R_ExternalPtrAddr(prep[1]);
241238
auto stream_out = reinterpret_cast<struct ArrowArrayStream*>(
242239
R_ExternalPtrAddr(stream_xptr));
243240

244241
OGRSpatialReference* crs = poLayer->GetSpatialRef();
245-
char* wkt_out;
242+
243+
246244
std::string wkt_str;
247245
if (crs != nullptr) {
248246
char* wkt_out;
@@ -267,9 +265,7 @@ inline Rcpp::List read_gdal_stream(
267265
num_features = -1;
268266
}
269267

270-
if (! Rcpp::CharacterVector::is_na(query[0])) {
271-
//poDS->ReleaseResultSet(poLayer);
272-
}
268+
273269

274270
return Rcpp::List::create(wkt_str, Rcpp::NumericVector::create(num_features));
275271
}

inst/include/gdalreadwrite/gdalreadwrite.h

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,14 +100,18 @@ inline CharacterVector gdal_create(CharacterVector filename,
100100
}
101101

102102
char *pszWKT = nullptr;
103+
OGRErr err;
104+
103105
#if GDAL_VERSION_MAJOR >= 3
104106
const char *optionsWKT[3] = { "MULTILINE=YES", "FORMAT=WKT2", NULL };
105-
OGRErr err = oSRS.exportToWkt(&pszWKT, optionsWKT);
107+
err = oSRS.exportToWkt(&pszWKT, optionsWKT);
106108
#else
107-
OGRErr err = oSRS.exportToWkt(&pszWKT);
109+
err = oSRS.exportToWkt(&pszWKT);
108110
#endif
109111

110-
112+
if (err != OGRERR_NONE) {
113+
Rcpp::stop("failed to export CRS to WKT");
114+
}
111115
GDALDriverH hDriver;
112116
hDriver = GDALGetDriverByName(driver[0]);
113117
if( hDriver == nullptr ) {

src/00_raster_block_io.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ Rcpp::NumericVector vapour_read_raster_value_cpp(CharacterVector dsource,
7878

7979
}
8080
GDALClose(ds);
81+
if (err != OGRERR_NONE) {
82+
Rcpp::stop("failed to read band values");
83+
}
8184
return vals;
8285
}
8386

tests/testthat/test-warper.R

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,10 @@ test_that("warper no transformation works", {
4646

4747
test_that("warper no transformation and no dimension works", {
4848
expect_that(vapour_warp_raster(f, extent = c(145, 146, -50, -48)), is_a("list"))
49-
expect_error(vapour_warp_raster(f, extent = c(145, 146, -50, -48), projection = "+proj=laea"),
50-
"could not be processed")
49+
## this used to give 0x0 output which is disallowed, GDAL now harmlessly returns a missing value with 1x1 dim
50+
# expect_error(vapour_warp_raster(f, extent = c(145, 146, -50, -48), projection = "+proj=laea"),
51+
# "could not be processed")
52+
5153

5254
})
5355

0 commit comments

Comments
 (0)