title: Mapbox No Source With This ID
body: <p>I want to remove sources and layers on Mapbox map. I managed to remove every sources and layers except for the first source and layer that I have added to Mapbox map.</p>
  
  <p>Note that I am not good in using jQuery $.post.</p>
  
  <p>Here is how I add all the sources and layers.</p>
  
  <pre><code>$.post('ajax/marker.php', function(data)
  {
      var firstSplit = data.split(",");
  
      for(i=0;i&lt;firstSplit.length-1;i++)
      {
          var secondSplit = firstSplit[i].split("|");
          var id = secondSplit[0];
          var lat = secondSplit[1];
          var lng = secondSplit[2];
  
          var point = {
              "type": "Point",
              "coordinates": [lat, lng]
          };
  
          map.addSource(id, { type: 'geojson', data: point });
          map.addLayer({
              "id": id,
              "type": "symbol",
              "source": id,
              "layout": {
                  "icon-image": "airport-15"
              }
          }); 
      }
  }); 
  </code></pre>
  
  <p><strong>Remember that, I managed to view all the sources and layers on Mapbox map.</strong>
  Its just that I am <strong>not able to remove only the first source and layers</strong> that I have added to the map. I hope someone out there has some ideas regarding this problem. Thanks.</p>
  
  <p>I used the two statements below in a loop to remove sources and layers.</p>
  
  <pre><code>map.removeSource(id);
  map.removeLayer(id);
  </code></pre>
  
  <p>I did a test to remove the first source and layers manually as below but it did not work.</p>
  
  <pre><code>map.removeSource('1612280004A');
  map.removeLayer('1612280004A');
  </code></pre>
  
  <p>However, it works on the next sources and layers.</p>