gdaldem
function bwareaopen(I::Union{GMTimage{UInt8,2}, GMTimage{Bool,2}}; keepwhites::Bool=false, keepblacks::Bool=false, kwargs…)::GMTimage d = KW(kwargs) # When the memory layout is column major, the gmt2gd step has to make a data copy, so we better forget the # possibility an insitu gdalsievefilter operation and do a copy right away when layout is row major. Ic::GMTimage{UInt8,2} = helper_run_GDAL_fun(gdalsievefilter, I.layout[2] == ‘C’ ? I : deepcopy(I), ““, String[],”“, d…) (!keepwhites && !keepblacks) && return Ic white = (I.range[6] == 1) ? UInt8(1) : UInt8(255) black = UInt8(0) if (keepwhites) for k = 1:numel(Ic) @inbounds (I[k] == white) && (Ic[k] = white) end else for k = 1:numel(Ic) @inbounds (I[k] == black) && (Ic[k] = black) end end return Ic end function bwareaopen(data::String; kwargs…) data = gmtread(data, layout=”TRB”) bwareaopen(data; kwargs…) end
—————————————————————————————————
““” gdaldem(dataset, method, options=String[]; dest=“/vsimem/tmp”, color=name|GMTcpt, kw…)
Tools to analyze and visualize DEMs.
Parameters
datasetThe source dataset.methodthe processing to apply (one of “hillshade”, “slope”, “aspect”, “color-relief”, “TRI”, “TPI”, “Roughness”).optionsList of options (potentially including filename and open options). The accepted options are the ones of the gdaldem utility.
Keyword Arguments
colorcolor file (mandatory for “color-relief” processing, should be empty otherwise). Ifcoloris just a CPT name we compute a CPT from it and the input grid.kw...keyword=value arguments whenmethodis hillshade.
Returns
A GMT grid or Image, or a GDAL dataset (or nothing if file was writen on disk).