Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function initializeMapView(id: string): MapView {
const canvas = document.getElementById(id) as HTMLCanvasElement;
const themePromise: Promise = ThemeLoader.loadAsync(
"resources/berlin_tilezen_base.json"
);
const map = new MapView({
canvas,
theme: themePromise.then(modifyTheme)
});
const NY = new GeoCoordinates(40.705, -74.01);
map.lookAt(NY, 3000, 30);
CopyrightElementHandler.install("copyrightNotice", map);
const mapControls = new MapControls(map);
const ui = new MapControlsUI(mapControls);
canvas.parentElement!.appendChild(ui.domElement);
map.resize(window.innerWidth, window.innerHeight);
.onChange((themeUrl: string) => {
theme = themeUrl;
ThemeLoader.loadAsync(themeUrl).then((newTheme: Theme) => {
mapViewApp.mapView.clearTileCache();
mapViewApp.mapView.theme = newTheme;
});
})
.setValue("resources/berlin_tilezen_base.json");