Google forEach map.data feature - return feature LatLng
问题 I am trying to iterate through GeoJSON map.data using a forEach. I want to return the position (LatLng) of each feature so I can add it to my markers array based on a feature property. Here's my attempt: allMarkers = []; jQuery.getJSON('json.php', function(data){ points = map.data.addGeoJson(data); }); var eid = 30; map.data.forEach(function(feature){ if(feature.getProperty('eid') === eid){ LatLng = feature.getGeometry().LatLng; //not sure how to get LatLng id = feature.getProerty('id'); var