// creates pins import { Feature } from "ol"; import { Icon, Style } from "ol/style"; import Point from "ol/geom/Point.js"; const makePin = (lon, lat, storeName, cheapest, flozPrice) => { // define pin graphics (since this is all inline) const pinSVG = ``; const pinSVGBlob = new Blob([pinSVG], { type: "image/svg+xml", }); const pinImageURL = URL.createObjectURL(pinSVGBlob); // define style for all pins const pinStyle = new Style({ image: new Icon({ src: pinImageURL, anchor: [0.5, 1], }), }); // create pin as feature const pin = new Feature({ geometry: new Point([lon, lat]), store: storeName, cheapestItem: cheapest, pricePerOz: flozPrice, }); // set style for pin pin.setStyle(pinStyle); return pin; }; export default makePin;