I am adding a feature layer of ol.geom.Point
geometry as follows:
var location = result.geometry.location;
var lat = location.lat.apply();
var lng = location.lng.apply();
var locationCoordinates = [lat, lng];
var vectorSource = new ol.source.Vector({});
var iconFeature = new ol.Feature({ geometry: new ol.geom.Point(ol.proj.transform(locationCoordinates, EPSG_3857, EPSG_4326)) });
vectorSource.addFeature(iconFeature);
var vectorLayer = new ol.layer.Vector({ source: vectorSource });
map.addLayer(vectorLayer);
vectorLayer.setVisible(true);
var extent = vectorLayer.getSource().getExtent();
map.getView().fitExtent(extent, map.getSize());
But the layer is misplaced, not exactly on longitude and latitude.
I am using EPSG:4326 projection, transforming Google Maps that's supposed to use EPSG:3857 projection.