title: Leaflet.js - Create layers and add markers depending on geojson category data?
body: <p>I have a .js file with coordinates for internships:</p>
  
  <pre><code>var internships = [{
    "features": [
      {"type":"Feature","properties":{"category":"entretient","Name":"green"},"geometry":{"type":"Point","coordinates":[50.807149, 3.162994]}},
      {"type":"Feature","properties":{"category":"securité","Name":"blue"},"geometry":{"type":"Point","coordinates":[50.334421, 3.290146]}},
      {"type":"Feature","properties":{"category":"secretaria","Name":"red"},"geometry":{"type":"Point","coordinates":[50.744787, 2.256216]}}
    ]
  }];
  </code></pre>
  
  <p>I've found this bit of code allowing me to create layers depending on a property and here what my JS looks like:</p>
  
  <pre><code>$.getScript("CoordinatesPdC.js");
  
  function mapLoad() {
    var sécuritéLayer = new L.LayerGroup();
    var secrétariatLayer = new L.LayerGroup();
    var entretientLayer = new L.LayerGroup();
  
    var map = L.map('map').setView([50.2910, 2.7775], 8);
  
    L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
      maxZoom: 18,
      attribution: 'Map data &amp;copy; &lt;a href="https://www.openstreetmap.org/"&gt;OpenStreetMap&lt;/a&gt; contributors, ' +
      '&lt;a href="https://creativecommons.org/licenses/by-sa/2.0/"&gt;CC-BY-SA&lt;/a&gt;, '
    }).addTo(map);
  
    var marker = L.marker([50.2910, 2.7775]).addTo(map);
  
    var entretientLayer = L.geoJson(internships, {
      filter: function (feature, layer) {
        return (feature.properties.category === "entretient");
      }
    }).addTo(map);
  
    var sécuritéLayer = L.geoJson(internships, {
      filter: function (feature, layer) {
        return (feature.properties.category === "sécurité");
      }
    }).addTo(map);
  
    var secrétariatLayer = L.geoJson(internships, {
      filter: function (feature, layer) {
        return (feature.properties.category === "secrétariat");
      }
    }).addTo(map);
  
  }
  
  window.onload = mapLoad;
  </code></pre>
  
  <p>But now I have to create the markes assigned to these layers, how can I achieve that?</p>