0
0
mirror of https://github.com/Maks1mS/free-ozon-dpr.git synced 2024-12-24 02:52:58 +03:00
free-ozon-dpr/map.js

38 lines
907 B
JavaScript
Raw Normal View History

2024-06-05 14:56:19 +03:00
import 'ol/ol.css';
import Map from 'ol/Map';
import View from 'ol/View';
import TileLayer from 'ol/layer/Tile';
import { fromLonLat } from 'ol/proj';
import { XYZ } from 'ol/source';
2024-06-05 17:37:47 +03:00
import { createXYZ } from 'ol/tilegrid';
2024-06-05 14:56:19 +03:00
const MAP_TARGET = 'map';
const MAP_CENTER = fromLonLat([37.57725139554275, 48.02287702854201]);
const MAP_ZOOM = 8.5;
const customTileSource = new TileLayer({
source: new XYZ({
2024-06-05 17:37:47 +03:00
// url: 'https://tile-server.ozon.ru/tile/default/{z}/{x}/{y}.png'
tileUrlFunction: ([z, x, y]) => {
const s = x % 4 + (y % 4) * 4
return `https://i${s}.wikimapia.org/?x=${x}&y=${y}&zoom=${z}&type=map&lng=1`
},
maxZoom: 18,
2024-06-05 14:56:19 +03:00
})
});
export const view = new View({
center: MAP_CENTER,
zoom: MAP_ZOOM,
})
const map = new Map({
target: MAP_TARGET,
layers: [
customTileSource
],
view,
});
export default map;