flowmapblue.R icon indicating copy to clipboard operation
flowmapblue.R copied to clipboard

Adding the setting button tab

Open rhs94 opened this issue 1 year ago • 5 comments

Hi

Is there a way to add the setting button to the htmlwidget (created/coded in RStudio) that are in the web version, as this one? https://www.flowmap.blue/1ndHiKo8z2B99ZQpToSfoIhI0RCbUsPZhqwNT0-U-TMk?v=14.163209%2C1.373237%2C1.65%2C0%2C0&a=0&as=1&b=1&bo=100&c=1&ca=1&d=1&fe=1&lt=1&lfm=ALL&col=Mint&f=60

rhs94 avatar Aug 24 '24 12:08 rhs94

@ilyabo and @e-kotov I really wish that you could add the setting tab and also add where you can change the map style as this on: https://app.flowmap.city/public/1681e562-8d37-4dcf-b088-8a6ab41884b9

I really hope that you will answer on whether this is something you will consider to implement in the package cause I really waited for this for a long time! :)

rhs94 avatar Aug 30 '24 18:08 rhs94

@rhs94 I believe this fork actually has the map style argument. You can try it https://github.com/JohMast/flowmapblue.R

e-kotov avatar Aug 30 '24 21:08 e-kotov

@rhs94 I believe this fork actually has the map style argument. You can try it https://github.com/JohMast/flowmapblue.R

Hi @e-kotov, I tried with this code:

if (!requireNamespace("devtools", quietly = TRUE)) { install.packages("devtools") } devtools::install_github("JohMast/flowmapblue.R") library(flowmapblue)

flowmapblue <- function( locations, flows, mapboxAccessToken = NULL, mapboxMapStyle = NULL, clustering = TRUE, animation = FALSE, darkMode = FALSE ) {

x <- list( locations = locations, flows = flows, mapboxAccessToken = mapboxAccessToken, mapboxMapStyle = mapboxMapStyle, clustering = clustering, animation = animation, darkMode = darkMode )

htmlwidgets::createWidget( name = 'flowmapblue', x, width = NULL, height = NULL, package = 'flowmapblue', sizingPolicy = sizingPolicy( padding = 0, browser.padding = 0 ) ) }

mapboxAccessToken <- 'pk.mytokenhere' mapboxMapStyle <- 'mapbox://styles/mapbox/navigation-day-v1'

(flowmap <- flowmapblue( locations, flows, mapboxAccessToken = mapboxAccessToken, mapboxMapStyle = mapboxMapStyle, darkMode = FALSE, clustering = TRUE, animation = FALSE ))

But the map does not change. Can you help me? I also tried to "make my own" map style and make it public and use the url instead but it doesn't work. What I wanted to use was actually mapbox://styles/mapbox/navigation-day-v1 from https://docs.mapbox.com/api/maps/styles/

rhs94 avatar Dec 27 '24 21:12 rhs94

@rhs94 I did not test this fork https://github.com/JohMast/flowmapblue.R myself. If if does not work, then very probably the version of the flowmapblue TypeScript widget shipped with the package does not actually support changing the mapbox style url. Also, I would suggest to ask the fork author @JohMast rather than here, as he would know better if it should work, and if so, why it does not work.

e-kotov avatar Jan 06 '25 22:01 e-kotov

Hi all! Yes, I agree with your assessment @e-kotov. That fork was was just a naive attempt to see if i could change the mapstyle by passing it as an argument, but it did not have the intended result and I did not pursue it further. I wrote the flowmapper functions which suffice for my applications, but for interactive visualisations I would love to see different mapstyles in the flowmapblue as well. I am not sure how much work that would be to implement, though.

JohMast avatar Jan 07 '25 09:01 JohMast