Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// end:harp_gl_rendering_synchronous_1.ts
map.renderLabels = false;
CopyrightElementHandler.install("copyrightNotice", map);
// Resize the mapView to maximum
map.resize(window.innerWidth, window.innerHeight);
// React on resize events
window.addEventListener("resize", () => {
map.resize(window.innerWidth, window.innerHeight);
});
const omvDataSource = new OmvDataSource({
baseUrl: "https://xyz.api.here.com/tiles/herebase.02",
apiFormat: APIFormat.XYZOMV,
styleSetName: "tilezen",
maxZoomLevel: 17,
authenticationCode: accessToken
});
map.addDataSource(omvDataSource);
return map;
}
mapView.lookAt(new GeoCoordinates(42, 14), 2000000, 40, -70);
const controls = new MapControls(mapView);
// Add an UI.
const ui = new MapControlsUI(controls);
canvas.parentElement!.appendChild(ui.domElement);
window.addEventListener("resize", () => {
mapView.resize(window.innerWidth, window.innerHeight);
});
const baseMapDataSource = new OmvDataSource({
baseUrl: "https://xyz.api.here.com/tiles/herebase.02",
apiFormat: APIFormat.XYZOMV,
styleSetName: "tilezen",
maxZoomLevel: 17,
authenticationCode: accessToken,
copyrightInfo
});
mapView.addDataSource(baseMapDataSource);
return mapView;
}
projection: sphereProjection,
theme: "resources/berlin_tilezen_base_globe.json"
});
canvas.addEventListener("contextmenu", e => e.preventDefault());
CopyrightElementHandler.install("copyrightNotice", mapView);
mapView.resize(window.innerWidth, window.innerHeight);
window.addEventListener("resize", () => {
mapView.resize(window.innerWidth, window.innerHeight);
});
const omvDataSource = new OmvDataSource({
baseUrl: "https://xyz.api.here.com/tiles/herebase.02",
apiFormat: APIFormat.XYZOMV,
styleSetName: "tilezen",
maxZoomLevel: 17,
authenticationCode: accessToken,
copyrightInfo
});
mapView.addDataSource(omvDataSource);
return mapView;
}
function main() {
const map = initializeMapView("mapCanvas");
const hereCopyrightInfo: CopyrightInfo = {
id: "here.com",
year: new Date().getFullYear(),
label: "HERE",
link: "https://legal.here.com/terms"
};
const copyrights: CopyrightInfo[] = [hereCopyrightInfo];
const omvDataSource = new OmvDataSource({
baseUrl: "https://xyz.api.here.com/tiles/herebase.02",
apiFormat: APIFormat.XYZOMV,
styleSetName: "tilezen",
maxZoomLevel: 17,
authenticationCode: accessToken,
copyrightInfo: copyrights
});
map.addDataSource(omvDataSource);
const mapControls = new MapControls(map);
const ui = new MapControlsUI(mapControls);
map.canvas.parentElement!.appendChild(ui.domElement);
map.setCameraGeolocationAndZoom(new GeoCoordinates(40.6935, -74.009), 4);
}
});
CopyrightElementHandler.install("copyrightNotice")
.attach(mapView)
.setDefaults([
{
id: "here.com",
label: "HERE",
link: "https://legal.here.com/terms",
year: 2019
}
]);
const omvDataSource = new OmvDataSource({
baseUrl: "https://xyz.api.here.com/tiles/herebase.02",
apiFormat: APIFormat.XYZOMV,
styleSetName: "tilezen",
maxZoomLevel: 17,
authenticationCode: "<%= access_token %>"
});
mapView.addDataSource(omvDataSource);
MapControls.create(mapView);
return mapView;
}
}
ui.domElement.style.right = width + 10 + "px";
canvas.parentElement!.appendChild(ui.domElement);
window.addEventListener("resize", () => {
const _width =
innerWidth <= 450
? 0
: Math.min(parseInt(editorWidth, undefined), innerWidth * 0.4);
canvas.className = "full";
ui.domElement.style.right = _width + 10 + "px";
mapView.resize(innerWidth - _width, innerHeight);
});
const baseMap = new OmvDataSource({
baseUrl: "https://xyz.api.here.com/tiles/herebase.02",
apiFormat: APIFormat.XYZOMV,
styleSetName: "tilezen",
maxZoomLevel: 17,
authenticationCode: accessToken,
copyrightInfo
});
mapView.addDataSource(baseMap);
return mapView;
}
canvas.parentElement!.appendChild(ui.domElement);
map.resize(window.innerWidth, window.innerHeight);
window.addEventListener("resize", () => {
map.resize(window.innerWidth, window.innerHeight);
});
return map;
}
const mapView = initializeMapView();
const omvDataSource = new OmvDataSource({
baseUrl: "https://xyz.api.here.com/tiles/herebase.02",
apiFormat: APIFormat.XYZOMV,
styleSetName: "tilezen",
maxZoomLevel: 17,
authenticationCode: accessToken,
copyrightInfo
});
mapView.addDataSource(omvDataSource);
const gui = new GUI({ width: 300 });
const options = {
theme: {
day: "resources/berlin_tilezen_base.json",
reducedDay: "resources/berlin_tilezen_day_reduced.json",
reducedNight: "resources/berlin_tilezen_night_reduced.json",
streets: "resources/berlin_tilezen_effects_streets.json",
outlines: "resources/berlin_tilezen_effects_outlines.json"
start() {
const hereCopyrightInfo: CopyrightInfo = {
id: "here.com",
year: new Date().getFullYear(),
label: "HERE",
link: "https://legal.here.com/terms"
};
const copyrights: CopyrightInfo[] = [hereCopyrightInfo];
const omvDataSource = new OmvDataSource({
baseUrl: "https://xyz.api.here.com/tiles/herebase.02",
apiFormat: APIFormat.XYZOMV,
styleSetName: "tilezen",
maxZoomLevel: 17,
authenticationCode: accessToken,
copyrightInfo: copyrights
});
const debugTileDataSource = new DebugTileDataSource(webMercatorTilingScheme);
this.mapView.addDataSource(omvDataSource);
this.mapView.addDataSource(debugTileDataSource);
this.initializeDebugView();
}