title: How to get the coordinates from the OpenLayers Map in ReactJS?
body: <p>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.</p>
  
  <p>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.</p>
  
  <pre><code>var glbox = map.getView().calculateExtent(map.getSize()); 
  var box = proj.transformExtent(glbox,'EPSG:3857','EPSG:4326'); 
  console.log("Latitude and longitude :",box);
  </code></pre>
  
  <p>So, I have tried with the below options as well and it is not resulting the expected long and lat.</p>
  
  <pre><code>console.log("Long and Lat :",map.getFeaturesAtPixel());  //--&gt; null
  console.log("Long and Lat :",map.getLayers());  
  console.log("Long and Lat :",map.getFeaturesAtPixel());  //--&gt; null
  </code></pre>
  
  <p>How can I get the latitude and longitude of the all three locations that are shown in the image?</p>
  
  <p><a href="https://i.stack.imgur.com/aifv8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/aifv8.png" alt="Map with Triangle Shape"></a></p>