Comments (3)
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);
from leaflet-locatecontrol.
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.
from leaflet-locatecontrol.
@chk1 Awesome. I just created a label for issues with solutions like yours!
from leaflet-locatecontrol.
Related Issues (20)
- InitialZoomLevel HOT 3
- Allow to set speed of "flyTo" animation HOT 3
- How can I put compass on the specified location on map HOT 1
- stopFollowing method throws error
- `role="button"` on the control HOT 2
- Icon in dark mode HOT 3
- GPS Altitude HOT 1
- Warning: "listener not found" for leaflet 1.8.0 HOT 1
- ES module support? HOT 1
- flyTo and untilPanOrZoom combination breaks following
- markerClass and LocationMarker HOT 1
- Dropping Mapbox.js support? HOT 2
- calling stopLocate on null
- locateOptions (eg: keepCurrentZoomLevel) Not Working
- Compass displayed even when needing calibration HOT 1
- Not finding location in Chrome & Firefox for Mobile HOT 5
- Display lat, lng, alt in the inner marker popup
- CSS missing if installing with npm HOT 6
- Custom icons no longer support color status indicators
- Request: Add speed and track information HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from leaflet-locatecontrol.