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

fill out some ignored API functions #113

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 2 additions & 0 deletions src/downloader.jl
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ function unique_filename(url)
return string(hash(url))
end

file_ending(provider::TileProviders.Provider) = ".some_unknown_image_format"
Copy link
Collaborator

@rafaqz rafaqz Nov 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Provider urls usually end with the image format after you strip the query


function download_tile_data(dl::PathDownloader, provider::AbstractProvider, url)
unique_name = unique_filename(url)
path = joinpath(dl.cache_dir, unique_name * file_ending(provider))
Expand Down
6 changes: 6 additions & 0 deletions src/tiles.jl
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,12 @@ function load_tile_data(::AbstractProvider, downloaded::AbstractVector{UInt8})
return FileIO.load(format) # this works because we have ImageIO loaded
end

function load_tile_data(::AbstractProvider, downloaded::String)
io = IOBuffer(read(downloaded))
format = FileIO.query(io) # this interrogates the magic bits to see what file format it is (JPEG, PNG, etc)
return FileIO.load(format) # this works because we have ImageIO loaded
end

function Base.wait(tiles::TileCache; timeout=50)
# wait for all tiles to get downloaded
items = lock(tiles.tile_queue) do
Expand Down