Well I have this GeoJSON file :
{"type": "FeatureCollection", "features": [{"id": "1", "type": "Feature", "geometry":{"type":"Point","coordinates":[-5.8039556,35.7903036]},"properties": {"gid":"1","name":"Tanger Ville","link":"C:\\xampp\\htdocs\\final4\\img","layer":"Points"}}, {"id": "2", "type": "Feature", "geometry":{"type":"Point","coordinates":[-5.8053745,35.7896316]},"properties": {"gid":"2","name":null,"link":"C:\\xampp\\htdocs\\final4\\img","layer":"Points"}}, {"id": "3", "type": "Feature", "geometry":{"type":"Point","coordinates":[-5.8035001,35.7894603]},"properties": {"gid":"3","name":"Tanger Ville","link":"C:\\xampp\\htdocs\\final4\\img","layer":"Points"}}, {"id": "4", "type": "Feature", "geometry":{"type":"Point","coordinates":[-5.8026494,35.7909747]},"properties": {"gid":"4","name":"Tanger Ville","link":"C:\\xampp\\htdocs\\final4\\img","layer":"Points"}}, {"id": "6", "type": "Feature", "geometry":{"type":"Point","coordinates":[-5.8000892,35.7912068]},"properties": {"gid":"6","name":"Tanger Ville","link":"C:\\xampp\\htdocs\\final4\\img","layer":"Points"}}, {"id": "5", "type": "Feature", "geometry":{"type":"Point","coordinates":[-5.8034242,35.7892276]},"properties": {"gid":"5","name":"Tanger Ville","link":"C:\\xampp\\htdocs\\final4\\img","layer":"Points"}}, {"id": "7", "type": "Feature", "geometry":{"type":"Point","coordinates":[-5.8055798,35.7912481]},"properties": {"gid":"7","name":null,"link":"C:\\xampp\\htdocs\\final4\\img","layer":"Points"}}, {"id": "8", "type": "Feature", "geometry":{"type":"Point","coordinates":[-5.8046302,35.7890426]},"properties": {"gid":"8","name":null,"link":"C:\\xampp\\htdocs\\final4\\img","layer":"Points"}}]}
I want to retrieve only the coordinates , I used this function but It didn't work
var features = point_layer.getSource().getFeatures();
features.forEach((feature) => {
console.log(feature.getCoordinates());
});
it says " feature.getCoordinates is not a function" .
The main purpose is to get the coordinates to campare them to pixel clicked on map.