Closed XJRULO closed 8 years ago
Hi,
leafletR uses Maki for markers. See ?styleSingle
or check out the following code:
library(leafletR)
data(quakes)
dat1 <- toGeoJSON(data=quakes[1:10,], name="Quakes 1", dest=tempdir())
dat2 <- toGeoJSON(data=quakes[11:20,], name="Quakes 2", dest=tempdir())
# simple colored markers
sty1 <- styleSingle(marker="green") # only color
# markers with label, color and size
sty2 <- styleSingle(marker=c("triangle", "#E41A1C", "s"))
map <- leaflet(data=list(dat1, dat2), dest=tempdir(), style=list(sty1, sty2))
map
Gosh, I have to write a vignette someday...
Thnx, but now I have another problem. I'm trying to mix two layers, one I got from a shp file for conties (here in Mexico we call them "municipios" or "delegaciones), and the other one to point out specific places. If I don't use sty in the leaflet fuction then my two layers shows without problems (but without all the features I need to outpoint, though whith the nice button in the uper-right corner), but if I use sty parameter in the function, then the map is never rendered or generated. Both layers can be rendered If I use the fuction for each one, but as soon as I try to mix them, the problem emerges. I read in another thread that this, if I understood well, is a feature that is not finished in leafletR, am I wrong? This are the two styles I want to mix: styleGrad, and styleSingle. The strange thing, as I said, is that If I don't use sty attribute, then I can render both layers in the same map, and both with their own popups. Is there any solution? Thnx in advance...
GeoX:.
You installed the package from CRAN, right? I worked on this feature (combination of different style types on one map) some weeks ago. It is not tested very well, and therefore not released on CRAN yet.
So you could do me a favor by trying your code with the dev-version from GitHub :-)
if(packageVersion("devtools") < 1.6) {
install.packages("devtools")
}
devtools::install_github("chgrl/leafletR")
# YOUR CODE HERE
Cheers Christian
Hi Christian, Your new library is working like a charm with two different styles. Thnx a lot, I'll keep in touch for any improvement and for any other suggestion.
Greetings GeoX
Hi Christian, Is there a way to add Marker points, or other kind of interactive objects to the map, like with leaflet by Joe Cheng? I like your library, because i can work with shp files, but i would love to add some markers to point out important issues of it. Well, thanks in advance. Greetings