Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom marker #53

Closed
ghost opened this issue Jan 27, 2014 · 3 comments
Closed

Custom marker #53

ghost opened this issue Jan 27, 2014 · 3 comments
Labels

Comments

@ghost
Copy link

ghost commented Jan 27, 2014

Is it possible to set a custom marker instead of the stadard blue dot?

@domoritz
Copy link
Owner

Have a look at the options in https://github.com/domoritz/leaflet-locatecontrol#possible-options. You can change the style but it is actually not an icon but a circle drawn directly.

I think it would be nice to be able to use a real custom icon. If you want, send me a pull request.

@chk1
Copy link

chk1 commented Mar 23, 2015

Just FYI and anyone searching, here's how I did it:

var iconGreen = {
    iconUrl: 'leaf-green.png',
    shadowUrl: 'leaf-shadow.png',
    iconSize:     [38, 95],
    shadowSize:   [50, 64],
    iconAnchor:   [22, 94],
    shadowAnchor: [4, 62],
    popupAnchor:  [-3, -76]
};

L.control.locate({
    markerClass: L.marker,
    markerStyle: { 
        icon: L.icon( iconGreen ) 
    }
}).addTo(map);

JSFiddle Demo

@domoritz
Copy link
Owner

@chk1 Awesome. I just created a label for issues with solutions like yours!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants