makieorg / tyler.jl Goto Github PK
View Code? Open in Web Editor NEWMakie package to plot maptiles from various map providers
Home Page: https://makieorg.github.io/Tyler.jl/dev/
License: MIT License
Makie package to plot maptiles from various map providers
Home Page: https://makieorg.github.io/Tyler.jl/dev/
License: MIT License
Higher resolution figures should have more tiles, but currently the resolution has no effect and large plots appear a little pixelated.
So we can use Valhala and replace google maps!!!
I updated packages and Tyler.jl broke due to this issue: JuliaIO/ImageMagick.jl#209
To fix the issue I had to explicitly add:
removing ImageMagick
dependency in the future in favor of ImageIO
would probably be a good idea as it looks like there are plans to deprecate ImageMagick_jll
We have a first proof of concept for the tiling of a large diskarray at PyramidScheme.Jl
Would it be possible to expose these tiles, so that they could be plotted by Tyler?
I can post an example of the pyramids later.
For previewing providers its nice to not put in an extent and just get the overview.
We do not have compat entries for the dependencies in the Project.toml.
It would feel a lot snappier to download whatever is at the center of the zoom first (that's usually where I am looking and I assume others too). We can get axis mouse position and use it to define a square that gets queued first for each zoom level.
Currently the download is random, and after #13 its top to bottom, so the first tiles may even be mostly off screen.
This follows on from #13
When an extent is defined to zoom into the aspect ratio of the displayed image changes. I think this should be changed such that the zoomed image always fills the frame. Otherwise the area of display keeps changing and looks hacky.
change default zoom level for first run on Map
Rect selection docs, 4 numbers, 2 numbers
For now what are those 4 numbers? we should be able to do min_lon, max_lon, min_lat, max_lat
or min_lon, min_lat, max_lon, max_lat
plot tiles in a 3d axis, LScene.
expose function to plot new points in lon,lat coordinates to be plotted on top of tile.
expose axis?
I'm not sure when this happened but on master its now hard to zoom in to an exact point vertically. Horizontally it seems to be fine.
Has anyone tried to get Tyler.jl to work with basemaps in different projections?
Conversation from Slack
Tabea
How can you send it via JSServe? I can show the figure, but then it doesn't load further tiles
Simon Danisch
Ah, I suspect you may not have a websocket connection, leading to no interactivity... Can you zoom into a normal scatter(1:4) plot?
Tabea
Yes, I can also zoom into the Tyler map if using App(tyler.figure)
Simon Danisch
Oh.. that sounds like a bug then
Tabea
Well I think Tyler needs the screen to be open. I don't know if that's the case, if I am only showing the figure?
Simon Danisch
Ah there was an issue like that
Simon Danisch
I think we need to remove the display call in Tyler ^^
Tabea
How can we then check whether the Tyler map is open?
Simon Danisch
Good question.... I honestly don't know how this is even working with a display call inside app.. I will need to take a look at it
๐
Simon Danisch
But I suspect this needs a fix in Tyler
Simon Danisch
You could try to remove the display call and remove the isopen(screen) with some other condition... Maybe just true for a quick test
Tabea
That's not so trivial ๐
Screen is all over the place...
Tabea
I will give it a try
Simon Danisch
Ok, feel free to ask me if anything doesn't work ๐ Otherwise, I can take a look later today
Tabea
Ok, so it seems to work ๐ leaving the display.... but replacing isopen(screen) with true, then showing it via App(tyler.figure). But this can only be a hack๐
Simon Danisch
Sure... Lets see if we can find a better solution soon!
Anshul Singhvi
Why exactly does Tyler need the screen? It can always call update_state_before_display!(ax) on its axis, if that's what is needed
Simon Danisch
That's not what it's needed for
Simon Danisch
It doesn't really need screen, it was just easier for a first implementation
https://makieorg.github.io/Tyler.jl/dev/examples/generated/UserGuide/whale_ex/ downloads an mp4 file onto my machine, and doesn't show it on screen.
I think, that the attribution of the tile provider should be shown as a default on the lower part of the map.
The attribution should be available as a metadata entry in the TileProvider.
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
It would be nice if it would be possible to use a GeoAxis from GeoMakie in Tyler.Map.
When I am trying it, I get the following error:
fig = Figure()
julia> ax = GeoAxis(fig[1,1], dest="+proj=webmerc +datum=WGS84")
GeoAxis()
julia> mgeo = Tyler.Map(ext, m.crs, figure=fig,axis=ax)
ERROR: InexactError: trunc(Int64, NaN)
Stacktrace:
[1] trunc
@ ./float.jl:905 [inlined]
[2] round
@ ./float.jl:385 [inlined]
[3] macro expansion
@ ~/.julia/packages/StaticArrays/EHHaF/src/broadcast.jl:135 [inlined]
[4] __broadcast
@ ~/.julia/packages/StaticArrays/EHHaF/src/broadcast.jl:123 [inlined]
[5] _broadcast
@ ~/.julia/packages/StaticArrays/EHHaF/src/broadcast.jl:119 [inlined]
[6] copy
@ ~/.julia/packages/StaticArrays/EHHaF/src/broadcast.jl:60 [inlined]
[7] materialize
@ ./broadcast.jl:903 [inlined]
[8] round_to_IRect2D(r::GeometryBasics.HyperRectangle{2, Float32})
@ Makie ~/.julia/packages/Makie/VRavR/src/makielayout/helpers.jl:7
[9] (::Makie.var"#1456#1457")(bbox::GeometryBasics.HyperRectangle{2, Float32}, limits::Rect2{Float64}, aspect::DataAspect)
@ Makie ~/.julia/packages/Makie/VRavR/src/makielayout/helpers.jl:49
[10] invokelatest(::Any, ::Any, ::Vararg{Any}; kwargs::@Kwargs{})
@ Base ./essentials.jl:892
[11] invokelatest(::Any, ::Any, ::Vararg{Any})
@ Base ./essentials.jl:889
[12] (::Observables.MapCallback)(value::Any)
@ Observables ~/.julia/packages/Observables/YdEbO/src/Observables.jl:436
[13] #invokelatest#2
@ ./essentials.jl:892 [inlined]
[14] invokelatest
@ ./essentials.jl:889 [inlined]
[15] notify
@ ~/.julia/packages/Observables/YdEbO/src/Observables.jl:206 [inlined]
[16] setindex!(observable::Observable, val::Any)
@ Observables ~/.julia/packages/Observables/YdEbO/src/Observables.jl:123
[17] adjustlimits!(la::GeoAxis)
@ Makie ~/.julia/packages/Makie/VRavR/src/makielayout/blocks/axis.jl:1009
[18] (::GeoMakie.var"#51#53"{GeoAxis})(::GeometryBasics.HyperRectangle{2, Int64}, ::Rect2{Float64})
@ GeoMakie ~/.julia/packages/GeoMakie/vcMuZ/src/makie-axis.jl:28
[19] invokelatest(::Any, ::Any, ::Vararg{Any}; kwargs::@Kwargs{})
@ Base ./essentials.jl:892
[20] invokelatest(::Any, ::Any, ::Vararg{Any})
@ Base ./essentials.jl:889
[21] (::Observables.OnAny)(value::Any)
@ Observables ~/.julia/packages/Observables/YdEbO/src/Observables.jl:420
[22] #invokelatest#2
@ ./essentials.jl:892 [inlined]
[23] invokelatest
@ ./essentials.jl:889 [inlined]
[24] notify
@ ~/.julia/packages/Observables/YdEbO/src/Observables.jl:206 [inlined]
[25] setindex!(observable::Observable, val::Any)
@ Observables ~/.julia/packages/Observables/YdEbO/src/Observables.jl:123
[26] reset_limits!(axis::GeoAxis; xauto::Bool, yauto::Bool)
@ GeoMakie ~/.julia/packages/GeoMakie/vcMuZ/src/makie-axis.jl:137
[27] reset_limits!
@ ~/.julia/packages/GeoMakie/vcMuZ/src/makie-axis.jl:44 [inlined]
[28] xlims!(ax::GeoAxis, xlims::Tuple{Float32, Float32})
@ GeoMakie ~/.julia/packages/GeoMakie/vcMuZ/src/makie-axis.jl:449
[29] limits!
@ ~/.julia/packages/GeoMakie/vcMuZ/src/makie-axis.jl:471 [inlined]
[30] Tyler.Map(extent::GeometryBasics.HyperRectangle{โฆ}, extent_crs::MapTiles.WebMercator; resolution::Tuple{โฆ}, figure::Figure, axis::GeoAxis, provider::TileProviders.Provider, crs::MapTiles.WebMercator, max_parallel_downloads::Int64, cache_size_gb::Int64, depth::Int64, halo::Float64, scale::Float64, max_zoom::Int64)
@ Tyler ~/.julia/packages/Tyler/J1n7N/src/Tyler.jl:146
[31] top-level scope
@ REPL[54]:1
Some type information was truncated. Use `show(err)` to see complete types.
This issue is used to trigger TagBot; feel free to unsubscribe.
If you haven't already, you should update your TagBot.yml
to include issue comment triggers.
Please see this post on Discourse for instructions and more details.
If you'd like for me to do this for you, comment TagBot fix
on this issue.
I'll open a PR within a few hours, please be patient!
There is still a small possibility of getting white flashes at the edges if you zoom out really fast after doing lots of scrolling around when zoomed in.
We could get around this and any other white flash problems by having some zoomed out tiles always sitting behind the other plots. At least you would see a blurry pixel of the right color instead of the obvious white flash. In the small flicker that its there for probably no one would notice how blurred it is. But the plain white background is really obvious.
rafaqz/Extents.jl#10 breaks Tyler
Extents.intersect need to be changed to Extents.intersection and comp for Extents needs to be >= Extents v0.1.2
f = Figure(resolution=(1912 * scale, 2284 * scale))
ga = f[1:2, 1] = GridLayout()
m = Tyler.Map(extent; provider, figure = f, axis = ga);
throws this error:
ERROR: type GridLayout has no field autolimitaspect
Stacktrace:
[1] setproperty!
@ ~/.julia/packages/GridLayoutBase/lYdxT/src/gridlayout.jl:55 [inlined]
[2] Tyler.Map(extent::Extent{(:X, :Y), Tuple{Tuple{Int64, Int64}, Tuple{Int64, Int64}}}, extent_crs::MapTiles.WGS84; resolution::Tuple{Int64, Int64}, figure::Figure, axis::GridLayout, provider::Provider, crs::MapTiles.WebMercator, max_parallel_downloads::Int64, cache_size_gb::Int64, depth::Int64, halo::Float64, scale::Float64)
@ Tyler ~/.julia/packages/Tyler/mD1F5/src/Tyler.jl:126
[3] top-level scope
@ ~/Documents/GitHub/AltimPlots.jl/src/plot_data.jl:61
This might be overkill...
But google maps seems to avoid flickery tiles by loading more tiles at once. Or something. Tyler seems faster at getting tiles loaded than google maps, which is kinda surprising, but it gives this flickery effect.
If we fade in tile opacity for e.g. the first 0.2 seconds we could remove the tile flicker? Maybe that's expensive?
The CartoDB() is not working here, but it does when using https://github.com/JuliaGeo/Leaflet.jl, I checked and the call to the url is the same in both cases, namely
Provider("https://{s}.basemaps.cartocdn.com/{variant}/{z}/{x}/{y}{r}.png", Dict{Symbol, Any}(:url => "https://{s}.basemaps.cartocdn.com/{variant}/{z}/{x}/{y}{r}.png", :attribution => "(C) OpenStreetMap contributors (C) CARTO", :variant => "light_all", :name => "CartoDB.Positron", :subdomains => "abcd", :html_attribution => "© <a href=\"https://www.openstreetmap.org/copyright\">OpenStreetMap</a> contributors © <a href=\"https://carto.com/attributions\">CARTO</a>", :max_zoom => 20))
however something goes wrong here, at fetching time. I don't seem to find the differences. Help? Leaflet.jl is doing definitely something different.
In the current version, doing:
using WGLMakie
using Tyler
tyler = Tyler.Map(Rect2f(-0.0921, 51.5, 0.04, 0.025))
shows the map and getting new tiles is possible. However, some errors are alive ๐
weird: this only show up once (the first time I ran the lines).
ERROR: MethodError: no method matching similar(::Nothing, ::Type{Any})
Closest candidates are:
similar(::Union{LinearAlgebra.Adjoint{T, var"#s886"}, LinearAlgebra.Transpose{T, var"#s886"}} where {T, var"#s886"<:(AbstractVector)}, ::Type{T}) where T at /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/LinearAlgebra/src/adjtrans.jl:207
similar(::Union{LinearAlgebra.Adjoint{T, S}, LinearAlgebra.Transpose{T, S}} where {T, S}, ::Type{T}) where T at /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/LinearAlgebra/src/adjtrans.jl:211
similar(::Union{LinearAlgebra.Adjoint{T, S}, LinearAlgebra.Transpose{T, S}} where {T, S}, ::Type{T}, ::Tuple{Vararg{Int64, N}}) where {T, N} at /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/LinearAlgebra/src/adjtrans.jl:212
...
and
An exception was thrown in JS: Error: Key 18059950468910541220 not found! undefined
Additional message: Error while processing message {"payload":["normalmatrix",{"0":1,"1":0,"2":0,"3":0,"4":1,"5":0,"6":0,"7":0,"8":1}],"id":"18059950468910541220","msg_type":"0"}
Stack trace:
Error: Key 18059950468910541220 not found! undefined
at lookup_global_object (/Users/lalonso/.julia/packages/JSServe/KDXZU/js_dependencies/JSServe.bundled.js:3012)
at Object.process_message (/Users/lalonso/.julia/packages/JSServe/KDXZU/js_dependencies/JSServe.bundled.js:3085)
at /Users/lalonso/.julia/packages/JSServe/KDXZU/js_dependencies/Websocket.bundled.js:92
at new Promise (<anonymous>)
at websocket.onmessage (/Users/lalonso/.julia/packages/JSServe/KDXZU/js_dependencies/Websocket.bundled.js:90)
An exception was thrown in JS: Error: Key 18059950468910541220 not found! undefined
Additional message: Error while processing message {"payload":["normalmatrix",{"0":1,"1":0,"2":0,"3":0,"4":1,"5":0,"6":0,"7":0,"8":1}],"id":"18059950468910541220","msg_type":"0"}
Stack trace:
Error: Key 18059950468910541220 not found! undefined
at lookup_global_object
and when zoom in and out, the following warnings:
@/Users/lalonso/.julia/packages/JSServe/KDXZU/js_dependencies/Websocket.bundled.js:90
โ Warning: getting tile plot already plotted
โ @ Tyler ~/.julia/packages/Tyler/3bd3k/src/Tyler.jl:195
โ Warning: getting tile plot already plotted
โ @ Tyler ~/.julia/packages/Tyler/3bd3k/src/Tyler.jl:195
โ Warning: getting tile plot already plotted
โ @ Tyler ~/.julia/packages/Tyler/3bd3k/src/Tyler.jl:195
โ Warning: getting tile plot already plotted
โ @ Tyler ~/.julia/packages/Tyler/3bd3k/src/Tyler.jl:195
Not sure if this already works, but since this is the most complete package, I'll post it here.
Ideally we want this:
ax = plot(points)
background!(ax, TileProvider())
This requires that GeoInterface sets the crs on the plot object? Then we could derive an extent from the plot object (didn't test it, but I assume that's possible), which is enough (with a possible convert) to load the right tile(s) to plot in the background.
Just wondering how feasible is to have a provider for the 3d tiles from Google.
Altough, we still don't have 3d suport in Tyler.jl ๐ .
It would be nice if Map also accepted a Extents.jl extent as input:
i.e.
Map(rect::Union{Rect, Extent}, ..... )
Thinking about how the Julia Geo ecosystem could wow other communities, I was wondering if it could be possible to create interactive (scrollable and zoomable) animated maps. For example is there a way to make the "Whale shark example trajectory" interactive?
See the below MWE:
using Tyler, MapTiles, TileProviders, GLMakie
provider = TileProviders.NASAGIBS(:ViirsEarthAtNight2012)
m = Tyler.Map(HyperRectangle{2, Float32}(Float32[73.675735, 14.7520275], Float32[0.6598676, 1.0475613]), 15;
provider, min_tiles=8, max_tiles=16, figure=Figure(resolution=(1000, 600)))
this causes a loop that continuously prints out warnings of the form "z greater than max zoom!". I wasn't able to copy it, but that was the gist.
(also, what exactly is zoom, and how do I find its max/min?)
find a way to increase the font size for labels on top of tiles. Currently, they all are really small, specially when zooming in.
When using CairoMakie I get this error
ERROR: please load either GLMakie, WGLMakie or CairoMakie
Stacktrace:
[1] error(s::String)
@ Base ./error.jl:35
[2] Tyler.Map(rect::GeometryBasics.HyperRectangle{2, Float32}, zoom::Int64, input_cs::MapTiles.WGS84; figure::Figure, coordinate_system::MapTiles.WebMercator, provider::Provider, min_tiles::Int64, max_tiles::Int64, max_parallel_downloads::Int64, cache_size_gb::Int64)
@ Tyler ~/.julia/packages/Tyler/eajCg/src/Tyler.jl:79
[3] top-level scope
@ ~/Documents/GitHub/Altim.jl/src/geolocate_dev.jl:88
I suspect that Tyler only works with GLMakie ?
If that's the case the the Error message needs updating.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.