Skip to content

Commit

Permalink
make sure to check if there is a file name before adding it (#430)
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaqz authored Apr 29, 2023
1 parent 79353bc commit c6f4a24
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/sources/gdal.jl
Original file line number Diff line number Diff line change
Expand Up @@ -237,20 +237,28 @@ function DD.metadata(raster::AG.RasterDataset, args...)
scale = AG.getscale(band)
offset = AG.getoffset(band)
# norvw = AG.noverview(band)
path = first(AG.filelist(raster))
units = AG.getunittype(band)
upair = units == "" ? () : ("units"=>units,)
_metadatadict(GDALsource, "filepath"=>path, "scale"=>scale, "offset"=>offset, upair...)
filelist = AG.filelist(raster)
metadata = _metadatadict(GDALsource, "scale"=>scale, "offset"=>offset)
if units == ""
metadata["units"] = units
end
if length(filelist) > 0
metadata["filepath"] = first(filelist)
end
return metadata
end

# Rasters methods for ArchGDAL types ##############################

# Create a Raster from a dataset
Raster(ds::AG.Dataset; kw...) = Raster(AG.RasterDataset(ds); kw...)
function Raster(ds::AG.RasterDataset;
crs=crs(ds), mappedcrs=nothing,
crs=crs(ds),
mappedcrs=nothing,
dims=dims(ds, crs, mappedcrs),
refdims=(), name=Symbol(""),
refdims=(),
name=Symbol(""),
metadata=metadata(ds),
missingval=missingval(ds)
)
Expand Down

0 comments on commit c6f4a24

Please sign in to comment.