Closed avsdev-cw closed 6 years ago
Forgot to mention:
platform x86_64-pc-linux-gnu
arch x86_64
os linux-gnu
system x86_64, linux-gnu
status
major 3
minor 5.1
year 2018
month 07
day 02
svn rev 74947
language R
version.string R version 3.5.1 (2018-07-02)
nickname Feather Spray
Googleway version: 2.7.1
This line
layersList["layer_2",]$zindex
givs NA
Do you mean
layersList[ layersList$id == "layer_2", ]$zindex
?
Sorry yes, that was a mistake on my part trying to redact some of the sensitive info out of it. A shorter test is to simply spin up a shiny app ad do something like:
(not tested, I don't have R installed on this machine)
library(shiny)
library(googleway)
ui <- fluidPage(
google_mapOutput('map')
)
server <- function(input, output) {
output$map <- renderGoogle_map({
zIndex <- 5
google_map(key = "your_api_key") %>%
add_polygons(data = melbourne, polyline = "polyline", z_index = zIndex)
})
}
Thanks - yes I can reproduce the error.
Are you only seeing this issue inside a shiny
environment?
Nope, the following should trigger the issue:
library(googleway)
testFunc <- function(){
zIndex <- 5
google_map(key = "your_api_key") %>%
add_polygons(data = melbourne, polyline = "polyline", z_index = zIndex)
}
testFunc()
yes. On its own, outside a function/scoped environment I see it works
zIndex <- 5
google_map(key = "your_api_key") %>%
add_polygons(data = melbourne, polyline = "polyline", z_index = zIndex)
Yes, there's a disparity between z_index and layer_id in that layer_id works scoped, but z_index does not
yeah - they're used differently inside the add_*()
functions. I need to figure out where the z_index
is getting lost in the system.
I've just pushed a change to the master branch which I think solves the problem. Would you mind testing it?
devtools::install_github("SymbolixAU/googleway")
At the moment this fix is only for add_polygon()
On the snippets it seems to work. I won't be able to make the modifications to the main code body and test it properly until office hours tomorrow GMT (in about 10 hours from now)
That modification fixes the issues I was having - Thanks!
I believe there is a bug when using a scoped object to pass a value into z_index for add_polygons.
It appears to bubble up from createMapObject as shown by the trace below:
The relevant code sections are:
I have tried a few different methods of passing a value into the z_index (the only thing that works is passing in a hard coded number or a globally scoped object).
Originally I tried passing in a value the exact same way as I am passing in a value for layer_id (which works for layer_id but not for z_index).