1

I am interested in making custom icons while using Leaflet in R.

The documentation has a nice example, but when experimenting with it, I realized that there is no way to allow the custom marker to resize when the map changes size.

Since size is one of the parameters and is fixed (iconWidth = 38, iconHeight = 95,), obviously the marker will stay consistently sized as zoom changes for map beneath it.

greenLeafIcon <- makeIcon(
  iconUrl = "http://leafletjs.com/docs/images/leaf-green.png",
  iconWidth = 38, iconHeight = 95,
  iconAnchorX = 22, iconAnchorY = 94,
  shadowUrl = "http://leafletjs.com/docs/images/leaf-shadow.png",
  shadowWidth = 50, shadowHeight = 64,
  shadowAnchorX = 4, shadowAnchorY = 62
)

Are there any hacks / ideas / protocols for having custom icons resize along with zoom?

tumultous_rooster
  • 12,150
  • 32
  • 92
  • 149

0 Answers0