Skip to content

Commit 879a0d3

Browse files
authored
Merge pull request #1998 from GenericMappingTools/drop-limits-test
Suspend a bb limits test in _helper_run_GDAL_fun
2 parents 13295cf + cfc17e7 commit 879a0d3

3 files changed

Lines changed: 11 additions & 11 deletions

File tree

ext/GMTDGTLidarExt/GMTDGTLidarExt.jl

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -405,9 +405,8 @@ module GMTDGTLidarExt
405405

406406
# Resolve output CRS: "geog" → EPSG:4326, bare digits → EPSG:<n>, anything else → pass directly
407407
t_srs = isempty(proj) ? "" :
408-
proj == "geog" ? "EPSG:4326" :
409-
all(isdigit, proj) ? "EPSG:$proj" :
410-
proj
408+
startswith(proj, "geo") ? "EPSG:4326" :
409+
all(isdigit, proj) ? "EPSG:$proj" : proj
411410

412411
# When tiles are explicitly provided from dgt_lidar, STAC selected exactly the right tiles — no clipping needed.
413412
# For point queries the bbox is epsilon (lon±1e-5) — also skip clip.
@@ -417,12 +416,11 @@ module GMTDGTLidarExt
417416
# gdalwarp: -te xmin ymin xmax ymax (bbox[1]=min_lon, bbox[3]=min_lat, bbox[2]=max_lon, bbox[4]=max_lat)
418417
opts = String[]
419418
if !skip_clip
420-
append!(opts, ["-te", string(bbox[1]), string(bbox[3]), string(bbox[2]), string(bbox[4]),
421-
"-te_srs", "EPSG:4326"])
419+
append!(opts, ["-te", string(bbox[1]), string(bbox[3]), string(bbox[2]), string(bbox[4]), "-te_srs", "EPSG:4326"])
422420
end
423421
!isempty(t_srs) && append!(opts, ["-t_srs", t_srs])
424-
inc != 0 && append!(opts, ["-tr", string(inc), string(inc)])
425-
append!(opts, ["-r", method, fmt_opts...])
422+
inc != 0 && append!(opts, ["-tr", string(inc), string(inc)])
423+
append!(opts, ["-r", method, fmt_opts..., "-dstnodata","NaN"])
426424
if use_mem
427425
vsimem = "/vsimem/dgt_mosaic_$(rand(UInt32)).tiff"
428426
GMT.gdalwarp(vrt_ds, opts; dest=vsimem)
@@ -433,8 +431,8 @@ module GMTDGTLidarExt
433431
GMT.gdalwarp(vrt_ds, opts; dest=outfile)
434432
else
435433
# bbox = [min_lon, max_lon, min_lat, max_lat]; -projwin expects: ulx uly lrx lry
436-
opts = skip_clip ? [fmt_opts...] :
437-
["-projwin", string(bbox[1]), string(bbox[4]), string(bbox[2]), string(bbox[3]),
434+
opts = skip_clip ? ["-a_nodata", "NaN", fmt_opts...] :
435+
["-a_nodata", "NaN", "-projwin", string(bbox[1]), string(bbox[4]), string(bbox[2]), string(bbox[3]),
438436
"-projwin_srs", "EPSG:4326", fmt_opts...]
439437
if use_mem
440438
vsimem = "/vsimem/dgt_mosaic_$(rand(UInt32)).tiff"

src/gdal/gdal_tools.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,13 +365,15 @@ function _helper_run_GDAL_fun(d_fun::Dict{Symbol, Function}, @nospecialize(indat
365365
end
366366

367367
dataset, needclose = get_gdaldataset(indata, opts, f == gdalvectortranslate || f == gdalgrid)
368+
#= # Suspend this test. I'm not sure if it's worth the trouble to do it, and it also causes problems with grdview drape
368369
if ((ind = findfirst("-projwin" .== opts)) !== nothing && !("-projwin_srs" in opts))
369370
x_min, x_max, y_min, y_max, = getregion(dataset)
370371
x_min > parse(Float64, opts[ind+1]) && error("Requested x_min " * opts[ind+1] * " is outside dataset extent")
371372
x_max < parse(Float64, opts[ind+3]) && error("Requested x_max " * opts[ind+3] * " is outside dataset extent")
372373
y_min > parse(Float64, opts[ind+4]) && error("Requested y_min " * opts[ind+4] * " is outside dataset extent")
373374
y_max < parse(Float64, opts[ind+2]) && error("Requested y_max " * opts[ind+2] * " is outside dataset extent")
374375
end
376+
=#
375377
((outname = add_opt(d, "", "", [:outgrid :outfile :save])) != "") && (dest = outname)
376378
default_gdopts!(f, dataset, opts, dest) # Assign some default options in function of the driver and data type
377379
((val = find_in_dict(d, [:meta])[1]) !== nothing && isa(val, Vector{String})) &&

test/test_misc.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@
227227
image_alpha!(I, alpha_ind=5);
228228
image_alpha!(I, alpha_vec=round.(UInt32,rand(6).*255));
229229
@info "before 3"
230-
@test_nowarn image_alpha!(I, alpha_band=round.(UInt8,rand(27,27).*255))
230+
image_alpha!(I, alpha_band=round.(UInt8,rand(27,27).*255))
231231
img = mat2img(rand(UInt8, 6, 6, 3));
232232
mask = fill(UInt8(0), 6, 6);
233233
mask[3:4,3:4] .= 255;
@@ -243,7 +243,7 @@
243243

244244
GMT.resetGMT()
245245
try
246-
@test_nowarn upGMT()
246+
upGMT()
247247
catch
248248
end
249249
image_cpt!(I, C)

0 commit comments

Comments
 (0)