0

The following is how I can center the markers icon with given size.

L.marker(center, {
    icon: L.icon({
        iconUrl: `<my-custom-icon.png>`,
        iconSize: [17,36],
        iconAnchor: [8.5,36]
    }),

How to reach the same when I have different sizes for markers icon?

I have different markers with different icon size. I could specify marker iconSize but, as for iconAnchor, I guess if I can set them in a programmatic way.

Any idea?

6
  • Doe's this mean you don't know the size of the icon or that you will not specify icon size with the iconSize option or both? Please edit your question with additional info.
    – TomazicM
    Commented Feb 14 at 16:33
  • Every marker have a different icon and every icon has a different size.
    – smartmouse
    Commented Feb 15 at 12:51
  • And I suppose you don't want to/will not specify marker size with the iconSize option?
    – TomazicM
    Commented Feb 15 at 13:20
  • I can specify marker iconSize but, as for iconAnchor, I guess if I can set them in a programmatic way.
    – smartmouse
    Commented Feb 16 at 8:31
  • Please edit your question with additional info from your comments so it can be reopened.
    – TomazicM
    Commented Feb 16 at 8:35

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.