Created
February 15, 2019 23:18
-
-
Save zinevych/c68a00a63b92480cb194be111167f150 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component } from '@angular/core'; | |
declare const google: any; | |
@Component({ | |
selector: 'app-root', | |
templateUrl: './app.component.html', | |
styleUrls: ['./app.component.scss'] | |
}) | |
export class AppComponent { | |
title: string = 'medium articles'; | |
lat: number = 36.778259; | |
lng: number = -119.417931; | |
zoom: number = 6; | |
mapInstance: any = null; | |
setMapInstance (event: any): void { | |
this.mapInstance = event; | |
this.mapInstance.overlayMapTypes.clear(); | |
this.mapInstance.overlayMapTypes.insertAt(0, this.getLayer()); | |
} | |
getLayer() { | |
let TILE_URL = 'http://127.0.0.1:8080/wildfire/{z}/{x}/{y}.png'; | |
let layerID = 'wildfire_layer'; | |
const layer = new google.maps.ImageMapType({ | |
name: layerID, | |
getTileUrl: function(coord, zoom) { | |
let url = TILE_URL | |
.replace('{x}', coord.x) | |
.replace('{y}', coord.y) | |
.replace('{z}', zoom); | |
return url; | |
}, | |
tileSize: new google.maps.Size(256, 256) | |
}); | |
return layer; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment