-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
28 lines (26 loc) · 847 Bytes
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import "./style.css";
import { Map, View } from "ol";
import OSM from "ol/source/OSM.js";
import projectionBNG from "./projection";
import TileLayer from "ol/layer/Tile";
// Set up a new Tile Layer
const openStreetMap = new TileLayer({
// OL has a number of built in sources, such as Stamen, OpenStreetMap, and BingMaps
source: new OSM(),
});
// Set up an instance of an OpenLayers map
const map = new Map({
// This is the HTML element we will target to render our map
target: "map",
layers: [
openStreetMap,
],
// A View object represents a simple 2D view of the map.
// This is the object to act upon to change the center, resolution, and rotation of the map
view: new View({
// Apply imported British National Grid as the projection
projection: projectionBNG,
center: [279731, 693249],
zoom: 6,
}),
});