-
-
Notifications
You must be signed in to change notification settings - Fork 56
Expand file tree
/
Copy pathindex.ts
More file actions
28 lines (26 loc) · 812 Bytes
/
index.ts
File metadata and controls
28 lines (26 loc) · 812 Bytes
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 mapboxgl from 'mapbox-gl';
import { MapboxExportControl, Size, PageOrientation, Format, DPI } from './src/lib/index';
import './src/scss/mapbox-gl-export.scss';
import { IControl } from 'mapbox-gl';
mapboxgl.accessToken = import.meta.env.VITE_MAPBOX_ACCESSTOKEN;
const map = new mapboxgl.Map({
container: 'map',
style: 'mapbox://styles/mapbox/standard',
// style: 'https://narwassco.github.io/mapbox-stylefiles/unvt/style.json',
center: [35.87063, -1.08551],
zoom: 12,
hash: true
});
map.addControl(
new MapboxExportControl({
PageSize: Size.A3,
PageOrientation: PageOrientation.Portrait,
Format: Format.PNG,
DPI: DPI[96],
Crosshair: true,
PrintableArea: true,
Local: 'en'
}) as unknown as IControl,
'top-right'
);
new mapboxgl.Marker().setLngLat([37.30467, -0.15943]).addTo(map);