0

I'm trying to add a vector layer manually to my map but i receive this error: Uncaught TypeError: b.attachEvent is not a function the code is :

// adding data 
// Define Geometries

var point = new ol.geom.Point(
    ol.proj.transform([10.8,36.7],'EPSG:4326','EPSG:3857')
);
var circle = new ol.geom.Circle(
    ol.proj.transform([10.8,36.7],'EPSG:4326','EPSG:3857'),
    600000
);
// features
var pointFeature = new ol.Feature(point);
var circleFeature = new ol.Feature(circle);
// source
var vectorSource = new ol.source.Vector({
    projection: 'EPSG: 4326'
});
vectorSource.addFeature([pointFeature,circleFeature]);
//vector Layer
var vectorLayer = new ol.layer.Vector({
    source: vectorSource
});
// add layer to the map
map.addLayer(vectorLayer);

I can't resolve it. enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.