0
0
mirror of https://github.com/Maks1mS/free-ozon-dpr.git synced 2024-12-23 18:42:59 +03:00
free-ozon-dpr/features.js
2024-06-05 14:56:19 +03:00

35 lines
814 B
JavaScript

import Feature from "ol/Feature";
import Point from "ol/geom/Point";
import { fromLonLat } from "ol/proj";
import { Circle as CircleStyle, Fill, Stroke, Style } from "ol/style";
const iconStyle = new Style({
image: new CircleStyle({
radius: 8,
fill: new Fill({
color: "#c90036",
}),
stroke: new Stroke({
color: "#fff",
width: 2,
}),
}),
});
function createFeatures(places) {
return places.map((place) => {
const feature = new Feature({
geometry: new Point(fromLonLat(place.coordinates)),
name: `[${place.provider}] ${place.name}`,
address: place.address,
link: place.link,
source: place.source,
operationTime: place.operationTime,
});
feature.setStyle(iconStyle);
return feature;
});
}
export { createFeatures };