传单中的自定义标记
Custom markers in leaflet
有没有办法在 R 中获取传单的自定义标记图标?我尝试使用教程中提供的示例代码,但是 makeIcon 函数似乎不存在。我试过的代码在这里但是没有用。
http://rstudio.github.io/leaflet/markers.html
如有任何建议,我们将不胜感激。总体目标是将其实现到闪亮的 Web 应用程序中。
非常感谢
makeIcon
功能确实存在,至少在我的传单包中。
以下代码(来自 tutorial)对我来说工作正常..
greenLeafIcon <- makeIcon(
iconUrl = "http://leafletjs.com/examples/custom-icons/leaf-green.png",
iconWidth = 38, iconHeight = 95,
iconAnchorX = 22, iconAnchorY = 94,
shadowUrl = "http://leafletjs.com/examples/custom-icons/leaf-shadow.png",
shadowWidth = 50, shadowHeight = 64,
shadowAnchorX = 4, shadowAnchorY = 62
)
leaflet(data = quakes[1:20,]) %>% addTiles() %>%
addMarkers(~long, ~lat, ~as.character(mag), icon = greenLeafIcon)
有没有办法在 R 中获取传单的自定义标记图标?我尝试使用教程中提供的示例代码,但是 makeIcon 函数似乎不存在。我试过的代码在这里但是没有用。
http://rstudio.github.io/leaflet/markers.html
如有任何建议,我们将不胜感激。总体目标是将其实现到闪亮的 Web 应用程序中。
非常感谢
makeIcon
功能确实存在,至少在我的传单包中。
以下代码(来自 tutorial)对我来说工作正常..
greenLeafIcon <- makeIcon(
iconUrl = "http://leafletjs.com/examples/custom-icons/leaf-green.png",
iconWidth = 38, iconHeight = 95,
iconAnchorX = 22, iconAnchorY = 94,
shadowUrl = "http://leafletjs.com/examples/custom-icons/leaf-shadow.png",
shadowWidth = 50, shadowHeight = 64,
shadowAnchorX = 4, shadowAnchorY = 62
)
leaflet(data = quakes[1:20,]) %>% addTiles() %>%
addMarkers(~long, ~lat, ~as.character(mag), icon = greenLeafIcon)