title: Heatmap from geojson points in leaflet
body: <p>I am attempting to create a simple heatmap from a feature collection of points using leaflet's heatmap plugin.  After successfully getting the json data from an ajax call, I create an empty coords array and push coordinates from each feature.  </p>
  
  <p>However, this method does not work and neither does the <a href="https://github.com/Leaflet/Leaflet.heat/issues/64" rel="nofollow noreferrer">geojson2heat</a> function.  There are no errors in the console.   What am I doing wrong and does anyone know of a workaround? </p>
  
  <pre><code>var map = L.map('map').setView([50.0647, 19.9450], 12);
  
  var tiles = L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
      attribution: '&amp;copy; &lt;a href="http://osm.org/copyright"&gt;OpenStreetMap&lt;/a&gt; contributors',
  }).addTo(map);
  var geojsonLayer = new L.GeoJSON.AJAX("newmap.geojson");
  
  coords = [];
  
  function onEachFeature(feature, layer) {
              coords.push(feature.geometry.coordinates);
  
  };
  
  L.GeoJSON(geojsonLayer, {
      onEachFeature: onEachFeature
  })
  
  var heat = L.heatLayer(coords).addTo(map);
  </code></pre>
  
  <p>The structure of the geojson is standard:</p>
  
  <pre><code>{
  "type": "FeatureCollection",
  "crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } },
  "features": [
  { "type": "Feature", "properties": { "st_x": 19.952030181884801, "st_y": 50.055513141929701 }, "geometry": { "type": "Point", "coordinates": [ 19.952030181884801, 50.055513141929701 ] } },
  { "type": "Feature", "properties": { "st_x": 18.672015, "st_y": 50.287181666666697 }, "geometry": { "type": "Point", "coordinates": [ 18.672015, 50.287181666666697 ] } },
  </code></pre>