[R-sig-Geo] Importing xlsm & blinking circilemarkers

sownal chand @own@|ch@nd|m@ @end|ng |rom gm@||@com
Fri Mar 18 23:23:50 CET 2022


Hi Roger

Thanks for your help and support.

Have a blessed weekend
Sownalc

On Sat, Mar 19, 2022, 01:47 Roger Bivand <Roger.Bivand using nhh.no> wrote:

> On Thu, 17 Mar 2022, sownal chand wrote:
>
> > Hello sir/madam,
> >
> > I have a macro-enabled excel file and wanted to import the data that this
> > file automatically grabs everytime the macro is run. Are there any
> packages
> > for macro-enabled excel?
>
> No idea, sounds like something for shiny, which I avoid. Interactive
> graphics are very hard to do right at the best of times.
>
> >
> > I have written some codes using a leaflet package and was trying to set
> > criteria for circle markers that if the Rainfall value is in the ranges
> the
> > color of the markers would change and start blinking. Given for green
> > 0-20mm, yellow - 20-30mm, orange- 30-50mm, red- >= 50mm.
> >
>
> library(sf)
> rainfall <- st_as_sf(read.csv("RainfalSample.csv"), coords=c("Long",
>   "Lat"), crs="OGC:CRS84")
> library(tmap)
> tmap_mode("view")
> tm_shape(rainfall) + tm_symbols(size=0.0025, col="Rainfall.mm.",
>   style="fixed", breaks=c(0, 20, 30, 50, Inf), pal=c("green", "yellow",
>   "orange", "red"))
>
> may be fairly close. tmap is a package using leaflet internally, mapview
> is another such package. Many of the symbols overlap, so are not very
> legible.
>
> Hope this helps,
>
> Roger
>
> > Given below is the code and sample data
> > library(sf)
> > library(leaflet)
> >
> > #Make Leaflet map with markers
> > leaflet() %>%
> >  addTiles() %>%
> >  addCircleMarkers(lat = rainfall$Latitude,
> >                   lng = rainfall$Longitude)
> >
> > # Add Data for rainfall
> > col_pal <- colorNumeric(palette = "viridis",
> >                        domain = rainfall$rainfall)
> >
> > #adding content to the popups
> > #Make map with colors with markers
> > Map<- leaflet() %>%
> >  addTiles() %>%
> >  addCircles(lat = Rainfall$Latitude,
> >           lng = Rainfall$Longitude,
> >           color = col_pal(Rainfall_plots$Rainfall),
> >           radius = 2000,
> >          fillOpacity = 0.8,
> >          label =  Rainfall_plots$rainfall) %>%
> > addLegend(position = "bottomleft", pal = col_pal, values =
> > Rainfall_plots$rainfall, title = "Rainfall Indicator")
> >
> > Map
> >
> ********************************************************************************************************
> >
> > The code is correct, some ideas to set up criterias for the rainfall
> amount
> > would really be appreciated. And possibly the codes as well would be
> really
> > wonderful. Also attached is the sample data in csv format
> >
> > Thanking you in advance
> > Sownalc
> >
>
> --
> Roger Bivand
> Emeritus Professor
> Department of Economics, Norwegian School of Economics,
> Postboks 3490 Ytre Sandviken, 5045 Bergen, Norway.
> e-mail: Roger.Bivand using nhh.no
> https://orcid.org/0000-0003-2392-6140
> https://scholar.google.no/citations?user=AWeghB0AAAAJ&hl=en
>

	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list