- first code with simple leaflet map
This commit is contained in:
parent
e9138a4c08
commit
2f048c1c0f
25 changed files with 19565 additions and 2 deletions
33
src/app/map/map.component.ts
Normal file
33
src/app/map/map.component.ts
Normal file
|
@ -0,0 +1,33 @@
|
|||
import { Component, AfterViewInit } from '@angular/core';
|
||||
import * as L from 'leaflet';
|
||||
|
||||
@Component({
|
||||
selector: 'app-map',
|
||||
templateUrl: './map.component.html',
|
||||
styleUrls: ['./map.component.css']
|
||||
})
|
||||
export class MapComponent implements AfterViewInit {
|
||||
|
||||
private map;
|
||||
|
||||
constructor() { }
|
||||
|
||||
private initMap(): void {
|
||||
this.map = L.map('map', {
|
||||
center: [ 48.208174, 16.373819],
|
||||
zoom: 3
|
||||
});
|
||||
const tiles = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||
maxZoom: 18,
|
||||
minZoom: 3,
|
||||
attribution: '© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
|
||||
});
|
||||
|
||||
tiles.addTo(this.map);
|
||||
}
|
||||
|
||||
ngAfterViewInit(): void {
|
||||
this.initMap();
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
editor.link_modal.header
Reference in a new issue