-
Notifications
You must be signed in to change notification settings - Fork 46
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
add label to geojson #257
Comments
can you give me the code you're using please? |
geo <- sf_geojson(sf_data) |
Can you make it reproducible please, so I can copy it into my own R session and reproduce what you're doing? |
As in this example, if we need to add label to each polygon/shape , eg. as we hover over shape it shows "area" and "name" of that shape library(googleway) |
The only way this is possible is to convert the geojosn to an sf <- geojsonsf::geojson_sf(geo_melbourne)
google_map(key = secret::get_secret("GOOGLE")) %>%
add_polygons(data = sf, mouse_over = "SA2_NAME") |
Firstly I tried with "add_polygon" function, but my shapefile has almost ~300 circles, and "add_polygon" function is not able to load shapefile even after ~30 minutes, So, as a workaround I was trying geojson |
could you try openeing it in a browser? |
I tried below example code,
In browser, able to see shapefile but tooltip, stroke_width etc. features are not working |
output$map <- renderGoogle_map({
sf <- geojsonsf::geojson_sf(geo_melbourne)
google_map() %>%
mapdeck::add_dependencies() %>%
mapdeck::add_polygon(data = sf,stroke_width = 5,stroke_colour = '#000000', tooltip = "SA2_NAME")
}) For me the tooltip is working: Do you get any errors in the javascript console? (In Chrome press Ctrl / Cmd + Shift + C, and go to the 'console' tab)? Next thing to try is to install the github / dev versions: remotes::install_github("SymbolixAU/googleway")
remotes::install_github("dcooley/geometries")
remotes::install_github("dcooley/sfheaders")
remotes::install_github("SymbolixAU/spatialwidget")
remotes::install_github("SymbolixAU/mapdeck")
|
That's not an error I recognise. I can see the |
It was not working earlier but than I installed all below packages from github and update their dependent packages after removing their previous version, now its working. thankyou so much for your support.
Also, is there any feature available in any googleway or mapdeck package similar to leaflet function GroupLayer/ControlGroupLayer? or any workaround for this? |
There is no such featuer in googleway or mapdeck. The work-around is to to use a radiobutton / checkboxgroup in shiny to toggle layers on / off. |
Hi, I was trying to add label to geojson, similar to polygon with attribute, mouse_over, but it through an error that its only accept TRUE/FALSE, can you please suggest how to add label to geojson feature.
The text was updated successfully, but these errors were encountered: