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

tmap.deckgl is born #866

Open
mtennekes opened this issue Apr 19, 2024 · 4 comments
Open

tmap.deckgl is born #866

mtennekes opened this issue Apr 19, 2024 · 4 comments

Comments

@mtennekes
Copy link
Member

mtennekes commented Apr 19, 2024

See https://github.com/r-tmap/tmap.deckgl

It's only a start, and mainly serves as a proof of concept for the extendibility of tmap.

remotes::install_github("r-tmap/tmap")
remotes::install_github("r-tmap/tmap.deckgl")

library(tmap)
library(tmap.deckgl)

tmap_mode("deck")
tm_shape(World) + tm_polygons("HPI", fill.scale = tm_scale_intervals(values = "RdYlGn"))
Screenshot 2024-04-19 at 14 18 31

Help is welcome, especially from those who know deck.gl.

As a second proof of concept, I will add a new 3d layer type, probably called tm_polygons3D.

@Nowosad
Copy link
Member

Nowosad commented Apr 20, 2024

Hi @mtennekes -- I was unable to reproduce this example (after installing everything):

library(tmap)
library(tmap.deckgl)

tmap_mode("deck")
#> tmap mode set to 'deck'
tm_shape(World) + tm_polygons("HPI", fill.scale = tm_scale_intervals(values = "RdYlGn"))
#> Error in tmapDeckGLCompPrepare(comp = structure(list(show = TRUE, design = "standard", : could not find function "tmapDeckGLCompPrepare"

@tim-salabim
Copy link

tim-salabim commented Apr 21, 2024

Same here, I get the same error!

Also, FWIW, @mtennekes et al. I know tmap.deckgl is meant as a POC for extending tmap, but I am currently working on (basically just started) implementing deck.gl-leaflet either as a standalone package or as part of leafgl. First POC shows that it is able to handle large amounts of points (haven't tested lines and polygons yet).

I just want to mention this here, as it has the advantage of not having to implement a completely new rendering environment (i.e. deckgl) but seems to play nicely with all the existing leaflet functionality. Though, this also means that things like extruded polygons won't make sense probably, as leaflet maps cannot be tilted...

Screenshot shows 1M points, behaving very smoothly

image

How do people feel about this? Should this be part of leafgl or be its own dedicated package?

@mtennekes
Copy link
Member Author

It's working now r-tmap/tmap.deckgl@0d59c9e (had to export a lot of internal methods)

Thanks @tim-salabim awesome developments!

How do people feel about this? Should this be part of leafgl or be its own dedicated package?

With 'own dedicated package' do you mean your just-started leaflet integration with deck.gl or the deckgl package? If the former, I don't have a strong opinion whether to have it a new package or part of leafgl.

From a tmap perspective:

  • For 2d maps, the deckgl-leaflet integration would be superior to the current leaflet layer methods, or are there any downsides? E.g. can all visual variables be encoded feature-wise, like stroke width and type? If so, these will eventually be replace the current leaflet layer methods in "view" mode.
  • I would love to have a 3d rendering mode. Just as a POC, I will add tm_polygons3D to tmap.deckgl.

I am also looking at rayshader route for 3d maps. If someone has low-level demo scripts how to create choropleths (without using ggplot2 because I'm still not familiar with the ggplot2 internals, so it's hard for me to reuse rayshader::plot_gg), most welcome.

@tim-salabim
Copy link

I've just started to add it to leafgl, mainly so I don't have to copy over all the helpers to a new package. I'll keep you updated on how things go. I will test all feature-wise mappings as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants