Interacting with the Control
Feed Data Back
@Input() set map(map: Map){
if (map) {
this._map = map;
this.control = new Control.Locate(this.options);
this.control.addTo(map);
let location$ = this.location$;
map.on('locationfound', function(e) {
const newLocation = new Location(latLng(e.latlng.lat, e.latlng.lng, Math.round(e.altitude || 0)),e.accuracy || 0);
newLocation.speed = e.speed || 0;
newLocation.timestamp = Date.now();
location$.emit(newLocation);
});
}
}
get map(): Map {
return this._map
}Worked Examples
Last updated