mirror of
https://github.com/Maks1mS/free-ozon-dpr.git
synced 2024-12-24 02:52:58 +03:00
35 lines
814 B
JavaScript
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 };
|