leaflet

R Leaflet. Group point data into cells to summarise many data points

限于喜欢 提交于 2021-01-27 07:54:44
问题 Morning, afternoon or evening. I have the following positional data (adjusted from 'Count of sampling points within a grid cell') # Demo data set.seed(123) # lat <- runif(1000, 46.5, 48.5) lon <- runif(1000, 13,16) # pos <- data.frame(lon, lat) Using the following: ggplot(pos, aes(x = lon, y=lat)) + geom_bin2d(bins = 25) + stat_bin_2d(aes(label=stat(count)), bins = 25, position="identity") + scale_fill_gradient(low = "white", high = "red")+ theme_void() gives: Awesome, but, I want to do the

R Leaflet. Group point data into cells to summarise many data points

倾然丶 夕夏残阳落幕 提交于 2021-01-27 07:53:36
问题 Morning, afternoon or evening. I have the following positional data (adjusted from 'Count of sampling points within a grid cell') # Demo data set.seed(123) # lat <- runif(1000, 46.5, 48.5) lon <- runif(1000, 13,16) # pos <- data.frame(lon, lat) Using the following: ggplot(pos, aes(x = lon, y=lat)) + geom_bin2d(bins = 25) + stat_bin_2d(aes(label=stat(count)), bins = 25, position="identity") + scale_fill_gradient(low = "white", high = "red")+ theme_void() gives: Awesome, but, I want to do the

Leaflet marker icon url compiled wrong while running ng build --prod

梦想的初衷 提交于 2021-01-27 07:41:18
问题 For some reason the Leaflet marker icon url compiled wrong while running ng build --prod instead when running ng build the Leaflet marker icon url is fine. My environment: Angular CLI: 7.0.5 Node: 11.2.0 OS: linux x64 Angular: 7.0.3 ... animations, common, compiler, compiler-cli, core, forms ... http, language-service, platform-browser ... platform-browser-dynamic, router Package Version ----------------------------------------------------------- @angular-devkit/architect 0.10.5 @angular

Leaflet marker icon url compiled wrong while running ng build --prod

南笙酒味 提交于 2021-01-27 07:41:11
问题 For some reason the Leaflet marker icon url compiled wrong while running ng build --prod instead when running ng build the Leaflet marker icon url is fine. My environment: Angular CLI: 7.0.5 Node: 11.2.0 OS: linux x64 Angular: 7.0.3 ... animations, common, compiler, compiler-cli, core, forms ... http, language-service, platform-browser ... platform-browser-dynamic, router Package Version ----------------------------------------------------------- @angular-devkit/architect 0.10.5 @angular

Leaflet marker icon url compiled wrong while running ng build --prod

佐手、 提交于 2021-01-27 07:40:27
问题 For some reason the Leaflet marker icon url compiled wrong while running ng build --prod instead when running ng build the Leaflet marker icon url is fine. My environment: Angular CLI: 7.0.5 Node: 11.2.0 OS: linux x64 Angular: 7.0.3 ... animations, common, compiler, compiler-cli, core, forms ... http, language-service, platform-browser ... platform-browser-dynamic, router Package Version ----------------------------------------------------------- @angular-devkit/architect 0.10.5 @angular

Leaflet marker icon url compiled wrong while running ng build --prod

故事扮演 提交于 2021-01-27 07:40:22
问题 For some reason the Leaflet marker icon url compiled wrong while running ng build --prod instead when running ng build the Leaflet marker icon url is fine. My environment: Angular CLI: 7.0.5 Node: 11.2.0 OS: linux x64 Angular: 7.0.3 ... animations, common, compiler, compiler-cli, core, forms ... http, language-service, platform-browser ... platform-browser-dynamic, router Package Version ----------------------------------------------------------- @angular-devkit/architect 0.10.5 @angular

Leaflet rendering incorrect countries

混江龙づ霸主 提交于 2021-01-27 07:15:41
问题 I am trying to plot few countries using leaflet but the countries that it is showing is incorrect. Following is my minimal reproducible example: library(leaflet) library(maps) df <- data.frame(name = c("Afghanistan", "Albania" , "Algeria" , "Armenia"), code = c("AFG", "ALB", "DZA", "ARM"), val = c(5, 10, 15, 20), stringsAsFactors = FALSE) pal <- colorNumeric( palette = "Blues", domain = as.numeric(df$val)) labels <- sprintf( "<strong>Country:%s</strong><br/>Value:%g /", df$name, df$val)%>%

Leaflet rendering incorrect countries

痴心易碎 提交于 2021-01-27 07:12:01
问题 I am trying to plot few countries using leaflet but the countries that it is showing is incorrect. Following is my minimal reproducible example: library(leaflet) library(maps) df <- data.frame(name = c("Afghanistan", "Albania" , "Algeria" , "Armenia"), code = c("AFG", "ALB", "DZA", "ARM"), val = c(5, 10, 15, 20), stringsAsFactors = FALSE) pal <- colorNumeric( palette = "Blues", domain = as.numeric(df$val)) labels <- sprintf( "<strong>Country:%s</strong><br/>Value:%g /", df$name, df$val)%>%

How can I access React state in my eventHandler?

妖精的绣舞 提交于 2021-01-24 07:23:24
问题 This is my state: const [markers, setMarkers] = useState([]) I initialise a Leaflet map in a useEffect hook. It has a click eventHandler. useEffect(() => { map.current = Leaflet.map('mapid').setView([46.378333, 13.836667], 12) . . . map.current.on('click', onMapClick) }, [] Inside that onMapClick I create a marker on the map and add it to the state: const onMapClick = useCallback((event) => { console.log('onMapClick markers', markers) const marker = Leaflet.marker(event.latlng, { draggable:

How can I access React state in my eventHandler?

久未见 提交于 2021-01-24 07:22:44
问题 This is my state: const [markers, setMarkers] = useState([]) I initialise a Leaflet map in a useEffect hook. It has a click eventHandler. useEffect(() => { map.current = Leaflet.map('mapid').setView([46.378333, 13.836667], 12) . . . map.current.on('click', onMapClick) }, [] Inside that onMapClick I create a marker on the map and add it to the state: const onMapClick = useCallback((event) => { console.log('onMapClick markers', markers) const marker = Leaflet.marker(event.latlng, { draggable: