Some three locations are connected in a triangle shape in Open Layer Map. I am trying to get all the three locations (latitude and longitude) with the help of OpenLayers and React JS. But unfortunately, I am able to get the Latitude and Longitude of visible view and not the marked layers.
When I used the below code, it is not fetching the expected long and lat and it is resulting the visible map long and lat.
var glbox = map.getView().calculateExtent(map.getSize());
var box = proj.transformExtent(glbox,'EPSG:3857','EPSG:4326');
console.log("Latitude and longitude :",box);
So, I have tried with the below options as well and it is not resulting the expected long and lat.
console.log("Long and Lat :",map.getFeaturesAtPixel()); //--> null
console.log("Long and Lat :",map.getLayers());
console.log("Long and Lat :",map.getFeaturesAtPixel()); //--> null
How can I get the latitude and longitude of the all three locations that are shown in the image?