MakieOrg / Tyler.jl

Makie package to plot maptiles from various map providers
https://makieorg.github.io/Tyler.jl/dev/
MIT License
73 stars 10 forks source link

Path to generic plots with GeoInterface #54

Open evetion opened 1 year ago

evetion commented 1 year ago

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.

rafaqz commented 1 year ago

The idea is to be able to put interactive Tyler underneath the current plot, and make it use the current CRS?

I guess we need to attach the crs to the axis somehow. Probably GeoMakie GeoAxis already has that, and we can just build on it instead?

Maybe we need to move to plotting tiles onto a mesh so it can be in any projection, rather than just tiling onto a regular grid. That would also facilitate using a globe, 3d terrain and other fun things. We would also have to increase the mesh detail as we zoom in like google earth does, but I'm not sure how to do that.

evetion commented 1 year ago

Well, I also would want it to work in the general Plots.jl ecosystem. This package is half generic code, half specific to Makie. Maybe this should be moved to GeoInterface for the implementation?

rafaqz commented 1 year ago

Yes that makes sense, maybe we can move some things to MapTiles.jl and define Plots.jl recipes in an extension there?

I'm not sure how we will get that exact code to work in Plots.jl, probably you would need to pass the crs to background

john-waczak commented 1 year ago

To @evetion's point, it would be super helpful to have a non-interactive version (perhaps using CairoMakie as the backend) to enable plotting geographic data on top of background maps with a fixed (or automatically determined) spatial extent.

I've been using Contextily via PythonCall for a hacky way to do this, but it would be great have native Julia implementation that can easily allow something like this matlab code

Happy to help work on something like this as it would be super helpful for my own work!

rafaqz commented 1 year ago

Yeah, we need to separate out plotting from the interactivity.

Have a go at a PR.

Im not sure how to structure it because currently so much is done in Map. Maybe you can define a MapSnapshot or something that just makes one map, and see how you can to refactor Map so they can share code.

evetion commented 1 year ago

Possibly define Extent (and crs?) on different plotlike things?