MakieOrg / Tyler.jl

Makie package to plot maptiles from various map providers

Home Page:https://makieorg.github.io/Tyler.jl/dev/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tyler.Map fails occasionally in VS Code

felixcremer opened this issue · comments

Sometimes the call of Tyler.Map fails when I call it from the VS Code julia terminal with the following error. This seems to come from an Any[] in the list of areas. Which fails later on.

julia> t = Tyler.Map(ext)
layer_range = 5:13
areas = Any[Any[], Any[], Extent{(:X, :Y), Tuple{Tuple{Float64, Float64}, Tuple{Float64, Float64}}}((X = (1.2855831266312003e6, 1.2957394671720564e6), Y = (6.600470208423706e6, 6.611200388901798e6))), Extent{(:X, :Y), Tuple{Tuple{Float64, Float64}, Tuple{Float64, Float64}}}((X = (1.2845674925771146e6, 1.2967551012261421e6), Y = (6.599397190375896e6, 6.612273406949608e6)))]
ext = Any[]
ERROR: MethodError: no method matching MapTiles.TileGrid(::Vector{Any}, ::Int64, ::MapTiles.WebMercator)

Closest candidates are:
  MapTiles.TileGrid(::Extent, ::Int64, ::MapTiles.WebMercator)
   @ MapTiles ~/.julia/packages/MapTiles/EEyFP/src/tiles.jl:136
  MapTiles.TileGrid(::Any, ::Any)
   @ MapTiles ~/.julia/packages/MapTiles/EEyFP/src/tiles.jl:111
  MapTiles.TileGrid(::Extent, ::Int64, ::MapTiles.WGS84)
   @ MapTiles ~/.julia/packages/MapTiles/EEyFP/src/tiles.jl:118
  ...

Stacktrace:
  [1] (::Tyler.var"#83#86"{Int64, Tyler.Map})(ext::Vector{Any})
    @ Tyler ~/.julia/dev/Tyler/src/Tyler.jl:345
  [2] iterate
    @ ./generator.jl:47 [inlined]
  [3] _collect(c::Vector{Any}, itr::Base.Generator{Vector{Any}, Tyler.var"#83#86"{Int64, Tyler.Map}}, #unused#::Base.EltypeUnknown, isz::Base.HasShape{1})
    @ Base ./array.jl:802
  [4] collect_similar
    @ ./array.jl:711 [inlined]
  [5] map
    @ ./abstractarray.jl:3263 [inlined]
  [6] #82
    @ ~/.julia/dev/Tyler/src/Tyler.jl:343 [inlined]
  [7] iterate
    @ ./generator.jl:47 [inlined]
  [8] _collect(c::UnitRange{Int64}, itr::Base.Generator{UnitRange{Int64}, Tyler.var"#82#85"{Tyler.Map, Vector{Any}}}, #unused#::Base.EltypeUnknown, isz::Base.HasShape{1})
    @ Base ./array.jl:802
  [9] collect_similar(cont::UnitRange{Int64}, itr::Base.Generator{UnitRange{Int64}, Tyler.var"#82#85"{Tyler.Map, Vector{Any}}})
    @ Base ./array.jl:711
 [10] map(f::Function, A::UnitRange{Int64})
    @ Base ./abstractarray.jl:3263
 [11] update_tiles!(tyler::Tyler.Map, area::Extent{(:X, :Y), Tuple{Tuple{Float64, Float64}, Tuple{Float64, Float64}}})
    @ Tyler ~/.julia/dev/Tyler/src/Tyler.jl:342
 [12] Tyler.Map(extent::Extent{(:X, :Y), Tuple{Tuple{Float32, Float32}, Tuple{Float32, Float32}}}, extent_crs::MapTiles.WGS84; resolution::Tuple{Int64, Int64}, figure::Figure, axis::Axis, provider::Provider, crs::MapTiles.WebMercator, max_parallel_downloads::Int64, cache_size_gb::Int64, depth::Int64, halo::Float64, scale::Float64, max_zoom::Int64)
    @ Tyler ~/.julia/dev/Tyler/src/Tyler.jl:170
 [13] Tyler.Map(extent::Extent{(:X, :Y), Tuple{Tuple{Float32, Float32}, Tuple{Float32, Float32}}}, extent_crs::MapTiles.WGS84)
    @ Tyler ~/.julia/dev/Tyler/src/Tyler.jl:95
 [14] Tyler.Map(extent::Extent{(:X, :Y), Tuple{Tuple{Float32, Float32}, Tuple{Float32, Float32}}})
    @ Tyler ~/.julia/dev/Tyler/src/Tyler.jl:95
 [15] top-level scope
    @ REPL[51]:1

I tracked down the issue to this line:

areas = if Extents.intersects(mouse_halo_area, area)

whose output now is a mix of Any[Any[], Extents(...), ...], and that inner Any[] is coming from this line:

mha = Extents.intersect(mouse_halo_area, area)
,
so I was thinking about filtering afterwards for that Any or? maybe a better solution is possible. For the moment I will not try to fix it 😄

This is a bug in Extents because it renamed intersect to intersection and now intersect is Base.intersect for some reason.