Skip to content

Commit

Permalink
fix gdal file load on windows (#437)
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaqz authored May 4, 2023
1 parent c6f4a24 commit fbb48f6
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/sources/gdal.jl
Original file line number Diff line number Diff line change
Expand Up @@ -126,15 +126,17 @@ function create(filename, ::Type{GDALsource}, T::Type, dims::DD.DimTuple;
end

function _open(f, ::Type{GDALsource}, filename::AbstractString; write=false, kw...)
# Handle url filenames
# /vsicurl/ is added to urls for GDAL, /vsimem/ for in memory
if length(filename) >= 8 && filename[1:8] in ("/vsicurl", "/vsimem/")
nothing
elseif _isurl(filename)
filename = "/vsicurl/" * filename
else
# check the file actually exists because GDALs error is unhelpful
isfile(filename) || _filenotfound_error(filename)
if !isfile(filename)
# Handle url filenames
# /vsicurl/ is added to urls for GDAL, /vsimem/ for in memory
if length(filename) >= 8 && filename[1:8] in ("/vsicurl", "/vsimem/")
nothing
elseif _isurl(filename)
filename = "/vsicurl/" * filename
else
# check the file actually exists because GDALs error is unhelpful
_filenotfound_error(filename)
end
end
flags = write ? (; flags=AG.OF_UPDATE) : ()
AG.readraster(cleanreturn f, filename; flags...)
Expand Down

0 comments on commit fbb48f6

Please sign in to comment.