r-leaflet

Leaflet for R: Display several data rows in popup

北战南征 提交于 2019-12-10 23:17:48
问题 While trying to map some quantitative data with leaflet in R , I manage to place pie-charts with leaflet.minicharts on the map, like in the following example: ### data ### d <- structure(list( area_name = c("Alscheid", "Alzingen", "Angelsberg", "Angelsberg", "Angelsberg", "Arsdorf","Asselborn", "Asselborn", "Baastenduerf", "Bartringen"), surveyID1 = c(1510L, 24L, 382L, 1429L, 1061L, 526L, 1524L, 1281L, 2169L, 1292L), Alter = c("25 bis 34", "25 bis 34", "15 bis 24", "15 bis 24", "25 bis 34",

openweathermap weather tile in Leaflet in R

南楼画角 提交于 2019-12-10 11:42:33
问题 I am trying to add custom weather tiles on a leaflet map in a Shiny application using leaflet-openweathermap javascript library available here. I am not conversant with javascript and the map doesn't render the weather layers. I first downloaded leaflet-openweathermap.js and placed it in www/js folder in my app's path. I then registered the plugin: openWeatherPlugin <- htmlDependency( "Leaflet.OpenWeather", "1.6.0", src = normalizePath(path = getwd()), script = "www/js/leaflet.openweathermap

Select only one state in a map in a Shiny application

╄→尐↘猪︶ㄣ 提交于 2019-12-10 10:04:06
问题 I have the following dataset: library(rgdal) library(leaflet) tmp <- tempdir() url <- "http://personal.tcu.edu/kylewalker/data/mexico.zip" file <- basename(url) download.file(url, file) unzip(file, exdir = tmp) mexico <- readOGR(dsn = tmp, layer = "mexico", encoding = "UTF-8") pal <- colorQuantile("YlGn", NULL, n = 5) state_popup <- paste0("<strong>Estado: </strong>", mexico$name, "<br><strong>PIB per c?pita, miles de pesos, 2008: </strong>", mexico$gdp08) On top of this data I build the

How can I turn my main dataframe into a reactive object on start?

瘦欲@ 提交于 2019-12-08 13:18:43
问题 I developed a nice leaflet-based shiny app where users can visualize over 50 socio-urban-demographic variables on a map displaying over 3000 polygon features. Users can also pick and transform any variable, perform regressions, build custom indexes and even run a spatial clustering algorithm. So, as you might have guessed already, the basic data structure consists of a main CSV dataframe featuring all the sociodemographic variables, and a shapeFile for the spatial polygons (both of which are

Creating a Leaflet map with custom labels in R

走远了吗. 提交于 2019-12-07 13:27:08
问题 I would like to visualize my data using a world map in R, where labels are to be added at certain points (given coordinates). The labels should be some 3D-rectangles with heights proportional to the value from data table. I would use the R package "leaflet" (or any alternative, if better). There are about 10-15 points around the world, and there are two values for each location (specifically, points are locations of major oil fields, and values are, for example, size and reserves). I want to

Shiny - how to highlight an object on a leaflet map when selecting a record in a datatable?

让人想犯罪 __ 提交于 2019-12-07 11:36:29
问题 Is there a way to highlight a marker or polyline on a leaflet map when selecting (clicking on) the corresponding record in a datatable? I looked at these questions/threads: selecting a marker on leaflet, from a DT row click and vice versa - no answer https://github.com/r-spatial/mapedit/issues/56 - check timelyportfolio's comment on Jul 23, 2017. As it shows in the gif, I would like to be able to select a row in the datatable so that the corresponding map object (marker/polyline) is

Select only one state in a map in a Shiny application

雨燕双飞 提交于 2019-12-05 18:37:42
I have the following dataset: library(rgdal) library(leaflet) tmp <- tempdir() url <- "http://personal.tcu.edu/kylewalker/data/mexico.zip" file <- basename(url) download.file(url, file) unzip(file, exdir = tmp) mexico <- readOGR(dsn = tmp, layer = "mexico", encoding = "UTF-8") pal <- colorQuantile("YlGn", NULL, n = 5) state_popup <- paste0("<strong>Estado: </strong>", mexico$name, "<br><strong>PIB per c?pita, miles de pesos, 2008: </strong>", mexico$gdp08) On top of this data I build the following Shiny Application: # load necessary packages library(leaflet) library(shiny) library

Flow map(Travel Path) Using Lat and Long in R

陌路散爱 提交于 2019-12-04 03:59:39
问题 I am trying to plot flow map (for singapore) . I have Entry(Lat,Long) and Exit (Lat,long). I am trying to map the flow from entry to exit in singapore map. structure(list(token_id = c(1.12374e+19, 1.12374e+19, 1.81313e+19, 1.85075e+19, 1.30752e+19, 1.30752e+19, 1.32828e+19, 1.70088e+19, 1.70088e+19, 1.70088e+19, 1.05536e+19, 1.44818e+19, 1.44736e+19, 1.44736e+19, 1.44736e+19, 1.44736e+19, 1.89909e+19, 1.15795e+19, 1.15795e+19, 1.15795e+19, 1.70234e+19, 1.70234e+19, 1.44062e+19, 1.21512e+19, 1

Popup when hover with leaflet in R?

こ雲淡風輕ζ 提交于 2019-12-03 05:13:48
问题 My leaflet map looks something like this: library(sp) library(leaflet) circleFun <- function(center = c(0,0),diameter = 1, npoints = 100){ r = diameter / 2 tt <- seq(0,2*pi,length.out = npoints) xx <- center[1] + r * cos(tt) yy <- center[2] + r * sin(tt) Sr1 = Polygon(cbind(xx, yy)) Srs1 = Polygons(list(Sr1), "s1") SpP = SpatialPolygons(list(Srs1), 1:1) return(SpP) } Circle.Town <- circleFun(c(1,-1),2.3,npoints = 100) df1 <- data.frame(long=c(0.6,1,1.4), lat=c(-2, -.8, -0.2), other=c('a', 'b'

Popup when hover with leaflet in R?

蓝咒 提交于 2019-12-02 17:38:41
My leaflet map looks something like this: library(sp) library(leaflet) circleFun <- function(center = c(0,0),diameter = 1, npoints = 100){ r = diameter / 2 tt <- seq(0,2*pi,length.out = npoints) xx <- center[1] + r * cos(tt) yy <- center[2] + r * sin(tt) Sr1 = Polygon(cbind(xx, yy)) Srs1 = Polygons(list(Sr1), "s1") SpP = SpatialPolygons(list(Srs1), 1:1) return(SpP) } Circle.Town <- circleFun(c(1,-1),2.3,npoints = 100) df1 <- data.frame(long=c(0.6,1,1.4), lat=c(-2, -.8, -0.2), other=c('a', 'b', 'c'), VAM=c(10,8,6), type=c('Public', 'Public', 'Private'), id=c(1:3)) %>% mutate(X=paste0('<strong