ol_scale_iconimage_discrete | R Documentation |
Map icon images to discrete variable values.
ol_scale_iconimage_discrete(icon.img.vector = NULL, name = NULL, na.img.src = NULL, ordered.values = NULL, display = FALSE, icon.width = NULL)
icon.img.vector |
character named vector of the form
|
name |
character the scale name. |
na.img.src |
character image path assigned to unrecognized or NA values. |
ordered.values |
character, numeric, or factor vector giving the
ordering for the legend display. If |
display |
logical indicating whether to draw the scale for output
in the HTML. If |
icon.width |
numeric width(s) of icons for the legend display only.
Icon widths for the map overlay are defined in |
This method maps OpenLayers point (icon) feature images to discrete variable values. This scale can be added to an Ol.Map S3 object only if the Ol.Map object has a layer with an "iconimage" mapping to a numeric, character, or factor variable. If no such layer exists, attempts to add this type of scale will result in a warning.
list of class Scale.IconImage.Discrete
.
ol_map
,
ol_geom_icon
,
freebsd.icon <- "https://www.freebsd.org/gifs/daemon-phk.png" freebsd.icon.width <- 191 r.icon <- "https://www.r-project.org/Rlogo.png" r.icon.width <- 200 loc.df <- data.frame( lon=c( -73.953, -78.938, -74.007 ), lat=c( 40.768, 36.001, 40.708 ), type=c( "R", "R", "BSD" ) ) icon.map <- ol_map( center=c(-75,38), zoom=5 ) + streetmap()+ ol_geom_icon( loc.df[,1:2], c(r.icon,freebsd.icon), mapping=ol_aes(iconimage=type), df = loc.df, name="Some Open Source Locations", icon.size.scalar='autoscale', src.img.width=c(r.icon.width,freebsd.icon.width), toggle.control=TRUE ) + ol_scale_iconimage_discrete( c(R=r.icon,BSD=freebsd.icon), display=TRUE ) ## Not run: # Oave as HTML and open in browser ol_map2HTML( icon.map, 'servers.html' ) browseURL("servers.html") ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.