Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Let getnodatavalue return nothing if there is none #176

Merged
merged 6 commits into from
Mar 14, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions src/raster/rasterband.jl
Original file line number Diff line number Diff line change
Expand Up @@ -164,19 +164,25 @@ end

Fetch the no data value for this band.

If there is no out of data value, an out of range value will generally be
returned. The no data value for a band is generally a special marker value
If there is no out of data value, `nothing` will be
returned instead. The no data value for a band is generally a special marker value
used to mark pixels that are not valid data. Such pixels should generally
not be displayed, nor contribute to analysis operations.

### Returns
the nodata value for this band.
the nodata value for this band or `nothing`.
"""
function getnodatavalue(band::AbstractRasterBand)
# ### Parameters
# * `pbSuccess` pointer to a boolean to use to indicate if a value is
# actually associated with this layer. May be `NULL` (default).
return GDAL.gdalgetrasternodatavalue(band.ptr, C_NULL)
hasnodatavalue = Ref(Cint(0))
nodatavalue = GDAL.gdalgetrasternodatavalue(band.ptr, hasnodatavalue)
if Bool(hasnodatavalue[])
return nodatavalue
else
return nothing
end
end

"""
Expand Down