Browse Source

feat: Add Markers in real time

master
Konstantinos Kamaropoulos 5 years ago
parent
commit
a937885269
  1. 4
      src/app/about/about.component.ts

4
src/app/about/about.component.ts

@ -22,6 +22,8 @@ export class AboutComponent implements OnInit {
lat = 37.9838; lat = 37.9838;
lng = 23.7275; lng = 23.7275;
sub: any;
constructor(private logsService: LogsService) {} constructor(private logsService: LogsService) {}
async ngOnInit() { async ngOnInit() {
@ -36,6 +38,7 @@ export class AboutComponent implements OnInit {
// Add map controls // Add map controls
// this.map.addControl(new mapboxgl.NavigationControl()); // this.map.addControl(new mapboxgl.NavigationControl());
this.sub = interval(1000).subscribe(async val => {
let data = await this.logsService.getUpdates(); let data = await this.logsService.getUpdates();
for (let log of data) { for (let log of data) {
if (log['gps_data']['status'] == 'A') { if (log['gps_data']['status'] == 'A') {
@ -59,5 +62,6 @@ export class AboutComponent implements OnInit {
.addTo(this.map); .addTo(this.map);
} }
} }
});
} }
} }

Loading…
Cancel
Save