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

Try to make Tyler GeoMakie compatible #78

Closed
wants to merge 4 commits into from
Closed
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: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ ImageMagick = "1"
ImageMagick_jll = "~6.9.12"
LRUCache = "1"
LinearAlgebra = "1"
Makie = "0.20"
Makie = "0.20, 0.21"
MapTiles = "1"
OrderedCollections = "1"
ThreadSafeDicts = "0.1"
Expand Down
12 changes: 6 additions & 6 deletions src/Tyler.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ using HTTP: HTTP
using ImageMagick: ImageMagick
using LRUCache: LRUCache, LRU
using MapTiles: MapTiles, Tile, TileGrid, web_mercator, wgs84, CoordinateReferenceSystemFormat
using Makie: Makie, Observable, Figure, Axis, RGBAf, on, isopen, meta, mesh!, translate!, scale!
using Makie: Makie, Observable, Figure, Axis, RGBAf, on, isopen, linesegments!, meta, mesh!, translate!, scale!
using OrderedCollections: OrderedCollections, OrderedSet
using ThreadSafeDicts: ThreadSafeDicts, ThreadSafeDict
using TileProviders: TileProviders, AbstractProvider, geturl, min_zoom, max_zoom
Expand Down Expand Up @@ -46,12 +46,12 @@ downloading and plotting more tiles as you zoom and pan.
-`scale`: a tile scaling factor. Low number decrease the downloads but reduce the resolution.
The default is `1.0`.
"""
struct Map
struct Map{A<:Makie.AbstractAxis}
provider::AbstractProvider
crs::CoordinateReferenceSystemFormat
zoom::Observable{Int}
figure::Figure
axis::Axis
axis::A
displayed_tiles::OrderedSet{Tile}
plots::Dict{Tile,Any}
free_tiles::Vector{Makie.Combined}
Expand Down Expand Up @@ -153,7 +153,6 @@ function Map(extent, extent_crs=wgs84;
Y = ext_target.Y
axis.autolimitaspect = 1
Makie.limits!(axis, (X[1], X[2]), (Y[1], Y[2]))

plots = Dict{Tile,Any}()
tyler = Map(
provider, crs,
Expand Down Expand Up @@ -283,6 +282,7 @@ function create_tile_plot!(tyler::Map, tile::Tile, image::TileImage)
end

function fetch_tile(tyler::Map, tile::Tile)
#println("Fetching Tile")
return get!(tyler.fetched_tiles, tile) do
fetch_tile(tyler.provider, tile)
end
Expand Down Expand Up @@ -417,8 +417,8 @@ function debug_tile!(map::Tyler.Map, tile::Tile)
end

function debug_tiles!(map::Tyler.Map)
for tile in m.displayed_tiles
debug_tile!(m, tile)
for tile in map.displayed_tiles
debug_tile!(map, tile)
end
end

Expand Down
Loading