@@ -122,31 +122,40 @@ regex_match <- function(text, pattern, i = NULL, ...) {
122122 c(xmin = 0 , ymin = 0 , xmax = n1 * cellsize_m , ymax = cellsize_m ),
123123 crs = grid_crs
124124 )
125- sample_grid_1 <- inspire_grid_from_extent_internal(
125+
126+ # Construct args to avoid passing ignored point_type (which warns)
127+ args1 <- list (
126128 grid_extent = sample_extent_1 ,
127129 cellsize_m = cellsize_m ,
128130 output_type = output_type ,
129131 id_format = id_format ,
130132 axis_order = " NE" ,
131- include_llc = include_llc ,
132- point_type = point_type
133+ include_llc = include_llc
133134 )
135+ if (output_type == " sf_points" ) {
136+ args1 $ point_type <- point_type
137+ }
138+ sample_grid_1 <- do.call(inspire_grid_from_extent_internal , args1 )
134139 size1 <- as.numeric(utils :: object.size(sample_grid_1 ))
135140
136141 # Create the second, larger sample grid.
137142 sample_extent_2 <- sf :: st_bbox(
138143 c(xmin = 0 , ymin = 0 , xmax = n2 * cellsize_m , ymax = cellsize_m ),
139144 crs = grid_crs
140145 )
141- sample_grid_2 <- inspire_grid_from_extent_internal(
146+
147+ args2 <- list (
142148 grid_extent = sample_extent_2 ,
143149 cellsize_m = cellsize_m ,
144150 output_type = output_type ,
145151 id_format = id_format ,
146152 axis_order = " NE" ,
147- include_llc = include_llc ,
148- point_type = point_type
153+ include_llc = include_llc
149154 )
155+ if (output_type == " sf_points" ) {
156+ args2 $ point_type <- point_type
157+ }
158+ sample_grid_2 <- do.call(inspire_grid_from_extent_internal , args2 )
150159 size2 <- as.numeric(utils :: object.size(sample_grid_2 ))
151160
152161 # Calculate the memory cost per additional cell (the slope).
@@ -261,36 +270,42 @@ regex_match <- function(text, pattern, i = NULL, ...) {
261270 n1 <- 10
262271 n2 <- 20
263272
273+ # Create sample 1
264274 # Create sample 1
265275 sample_extent_1 <- sf :: st_bbox(
266276 c(xmin = 0 , ymin = 0 , xmax = n1 * cellsize_m , ymax = cellsize_m ),
267277 crs = grid_crs
268278 )
269- sample_grid_1 <- inspire_grid_from_extent_internal(
279+
280+ # Prepare safe arguments
281+ out_type <- dot_args $ output_type %|| % " sf_polygons"
282+ pt_type <- dot_args $ point_type %|| % " centroid"
283+
284+ args1 <- list (
270285 grid_extent = sample_extent_1 ,
271286 cellsize_m = cellsize_m ,
272- output_type = dot_args $ output_type % || % " sf_polygons " ,
287+ output_type = out_type ,
273288 id_format = dot_args $ id_format %|| % " both" ,
274289 axis_order = dot_args $ axis_order %|| % " NE" ,
275- include_llc = dot_args $ include_llc %|| % TRUE ,
276- point_type = dot_args $ point_type %|| % " centroid"
290+ include_llc = dot_args $ include_llc %|| % TRUE
277291 )
292+ if (out_type == " sf_points" ) {
293+ args1 $ point_type <- pt_type
294+ }
295+
296+ sample_grid_1 <- do.call(inspire_grid_from_extent_internal , args1 )
278297 size1 <- as.numeric(utils :: object.size(sample_grid_1 ))
279298
280299 # Create sample 2
281300 sample_extent_2 <- sf :: st_bbox(
282301 c(xmin = 0 , ymin = 0 , xmax = n2 * cellsize_m , ymax = cellsize_m ),
283302 crs = grid_crs
284303 )
285- sample_grid_2 <- inspire_grid_from_extent_internal(
286- grid_extent = sample_extent_2 ,
287- cellsize_m = cellsize_m ,
288- output_type = dot_args $ output_type %|| % " sf_polygons" ,
289- id_format = dot_args $ id_format %|| % " both" ,
290- axis_order = dot_args $ axis_order %|| % " NE" ,
291- include_llc = dot_args $ include_llc %|| % TRUE ,
292- point_type = dot_args $ point_type %|| % " centroid"
293- )
304+
305+ args2 <- args1
306+ args2 $ grid_extent <- sample_extent_2
307+
308+ sample_grid_2 <- do.call(inspire_grid_from_extent_internal , args2 )
294309 size2 <- as.numeric(utils :: object.size(sample_grid_2 ))
295310
296311 # Calculate marginal bytes per cell
0 commit comments