Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const lookAt = mergeWithOptions(defaultLookAt, options.lookAt);
mapView.lookAt(
new GeoCoordinates(lookAt.latitute, lookAt.longitude),
lookAt.distance,
lookAt.tilt,
lookAt.azimuth
);
// Shutdown errors cause by firefox bug
mapView.renderer.getContext().getShaderInfoLog = (x: any) => {
return "";
};
const geoJsonDataSource = new OmvDataSource({
decoder: new OmvTileDecoder(),
dataProvider: new GeoJsonDataProvider(
"geojson",
typeof options.geoJson === "string"
? new URL(options.geoJson, window.location.href)
: options.geoJson,
{ tiler: new GeoJsonTiler() }
),
name: "geojson",
styleSetName: "geojson"
});
mapView.addDataSource(geoJsonDataSource);
await waitForEvent(mapView, MapViewEventNames.FrameComplete);
await ibct.assertCanvasMatchesReference(canvas, options.testImageName);
apiFormat: APIFormat.XYZOMV,
styleSetName: "tilezen",
maxZoomLevel: 17,
authenticationCode: accessToken,
copyrightInfo
});
mapView.addDataSource(baseMap);
// end:harp_gl_initmapview.ts
// snippet:harp_gl_staticgeojson.ts
const geoJsonDataProvider = new GeoJsonDataProvider(
"italy",
new URL("resources/italy.json", window.location.href)
);
const geoJsonDataSource = new OmvDataSource({
dataProvider: geoJsonDataProvider,
name: "geojson",
styleSetName: "geojson",
gatherFeatureAttributes: true
});
mapView.addDataSource(geoJsonDataSource).then(() => {
setStyleSet();
askName();
mapView.canvas.addEventListener("click", displayAnswer);
});
// end:harp_gl_staticgeojson.ts
// snippet:harp_gl_gamelogic.ts
function displayAnswer(e: MouseEvent) {
if (discardPick) {
export namespace TiledGeoJsonTechniquesExample {
document.body.innerHTML += `
<style>
#mapCanvas {
top: 0;
}
</style>
`;
const imageString =
// tslint:disable-next-line:max-line-length
"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDIyLjEuMCwgU1ZHIEV4cG9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iIvPgo8L2c+Cjwvc3ZnPgo=";
const mapView = initializeMapView("mapCanvas");
const omvDataSource = new OmvDataSource({
baseUrl: "https://xyz.api.here.com/tiles/osmbase/256/all",
apiFormat: APIFormat.MapzenV2,
styleSetName: "tilezen",
maxZoomLevel: 17
});
mapView.addDataSource(omvDataSource);
/**
* Creates a new MapView for the HTMLCanvasElement of the given id.
*/
// snippet:datasource_geojson_load1.ts
function initializeMapView(id: string): MapView {
const canvas = document.getElementById(id) as HTMLCanvasElement;
const sampleMapView = new MapView({
canvas,
synchronousRendering: true
});
// 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.dynamicPixelRatio = newDynamicPixelRatio;
toggleElement.innerText =
"dynamicPixelRatio: " +
(mapView.dynamicPixelRatio === undefined
? "default"
: String(mapView.dynamicPixelRatio));
});
}
}
const mapView = initializeMapView("mapCanvas");
// snippet:vislib_hello_animation_example_4.ts
const omvDataSource = new OmvDataSource({
baseUrl: "https://xyz.api.here.com/tiles/osmbase/256/all",
apiFormat: APIFormat.MapzenV2,
styleSetName: "tilezen",
maxZoomLevel: 17
});
// end:vislib_hello_animation_example_4.ts
// snippet:vislib_hello_animation_example_5.ts
mapView.addDataSource(omvDataSource);
// end:vislib_hello_animation_example_5.ts
initializePixelRatioToggle();
}
function addOmvDataSource(map: MapView) {
// snippet:harp_gl_hello_world_example_4.ts
const omvDataSource = new OmvDataSource({
url: "https://xyz.api.here.com/tiles/herebase.02/{z}/{x}/{y}/omv",
styleSetName: "tilezen",
maxZoomLevel: 17,
urlParams: {
access_token: accessToken
},
copyrightInfo
});
// end:harp_gl_hello_world_example_4.ts
// snippet:harp_gl_hello_world_example_5.ts
map.addDataSource(omvDataSource);
// end:harp_gl_hello_world_example_5.ts
return map;
}
// 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;
}
async connect(): Promise {
//not needed
}
// Returns italyData json object.
async getTile(): Promise<{}> {
return italyData;
}
}
// end:datasource_style_static.ts
const mapView = initializeMapView("mapCanvas");
const omvDataSource = new OmvDataSource({
baseUrl: "https://xyz.api.here.com/tiles/osmbase/256/all",
apiFormat: APIFormat.MapzenV2,
styleSetName: "tilezen",
maxZoomLevel: 17
});
mapView.addDataSource(omvDataSource);
initializeStyleSetToggle();
/**
* Creates a new MapView for the HTMLCanvasElement of the given id.
*/
// snippet:datasource_style1.ts
function initializeMapView(id: string): MapView {
const canvas = document.getElementById(id) as HTMLCanvasElement;
const sampleMapView = new MapView({
canvas,
// snippet:vislib_multiview_mapDiffView_2.ts
const dataSources = {
omvDataSource1: new OmvDataSource({
baseUrl: "https://xyz.api.here.com/tiles/osmbase/256/all",
apiFormat: APIFormat.MapzenV2,
createTileInfo: true,
styleSetName: "tilezen",
gatherFeatureIds: true,
showMissingTechniques: true,
tileFactory: new TileFactory(OmvDebugLabelsTile),
maxZoomLevel: 17
}),
omvDataSource2: new OmvDataSource({
baseUrl: "https://xyz.api.here.com/tiles/osmbase/256/all",
apiFormat: APIFormat.MapzenV2,
createTileInfo: true,
styleSetName: "tilezen",
gatherFeatureIds: true,
showMissingTechniques: true,
tileFactory: new TileFactory(OmvDebugLabelsTile),
maxZoomLevel: 17
})
};
mapViews.view1.mapView.addDataSource(dataSources.omvDataSource1);
mapViews.view2.mapView.addDataSource(dataSources.omvDataSource2);
CopyrightElementHandler.install("copyrightNotice")
.attach(mapViews.view1.mapView)
.attach(mapViews.view2.mapView)