forked from VinokurovVE/tests
32 lines
1.0 KiB
TypeScript
32 lines
1.0 KiB
TypeScript
import GeoJSON from "ol/format/GeoJSON";
|
|
import { get } from "ol/proj";
|
|
import { register } from "ol/proj/proj4";
|
|
import { XYZ } from "ol/source";
|
|
import VectorSource from "ol/source/Vector";
|
|
import proj4 from "proj4";
|
|
proj4.defs('EPSG:3395', '+proj=merc +lon_0=0 +k=1 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs')
|
|
register(proj4);
|
|
|
|
const yandexProjection = get('EPSG:3395')?.setExtent([-20037508.342789244, -20037508.342789244, 20037508.342789244, 20037508.342789244]) || 'EPSG:3395'
|
|
|
|
const googleMapsSatelliteSource = new XYZ({
|
|
url: `${import.meta.env.VITE_API_EMS_URL}/tile/google/{z}/{x}/{y}`,
|
|
attributions: 'Map data © Google'
|
|
})
|
|
|
|
const yandexMapsSatelliteSource = new XYZ({
|
|
url: `${import.meta.env.VITE_API_EMS_URL}/tile/yandex/{z}/{x}/{y}`,
|
|
attributions: 'Map data © Yandex',
|
|
projection: yandexProjection,
|
|
})
|
|
|
|
const regionsLayerSource = new VectorSource({
|
|
url: 'sakha_republic.geojson',
|
|
format: new GeoJSON(),
|
|
})
|
|
|
|
export {
|
|
googleMapsSatelliteSource,
|
|
yandexMapsSatelliteSource,
|
|
regionsLayerSource
|
|
} |