Questions & Answers

Open layer adding Maker with custom Icon

I am working on openlayers map application currently using "ol": "6.2.1" version for some reason Icon is not showing on map I searched alot to know the reason why it's not showing. Not sure what's wrong with my implementation.

import VectorSource from 'ol/source/Vector'
import Style from 'ol/style/Style';
import Icon from 'ol/style/Icon';
import Feature from 'ol/Feature';
import Point from 'ol/geom/Point';
import { fromLonLat, transform } from 'ol/proj';
import VectorLayer from 'ol/layer/Vector';

//here is code for adding markers layer

const markers = new VectorLayer({
      source:new VectorSource(),
      style: new Style({
        image:new Icon({
          anchor: [0.5, 1],
          src: "",
    for (let i = 0; i < coordinatesList.length; i++) {
         const marker =  new Feature({
            geometry: new Point(
              transform(coordinatesList[i], 'EPSG:27700', 'EPSG:3857'),

Using this implementation I am expecting all the markers with custom Icon should render on map

2023-01-17 23:20:15
The src url you are using does not support CORS so you cannot specify crossOrigin: 'anonymous'. Either remove crossOrigin: 'anonymous' (which is important only if you need to export the map for printing, etc.) or download the image to your own server.
Answers(0) :