title: Mapbox: dynamically loading vector data as the map is moved (panned/zoomed)?
body: <p>I would like to serve vector data to Mapbox clients: Mapbox-GL javascript clients (browsers) and possibly native Android and iOS app with the Mapbox SDKs. It looks like you only have 2 options when using Mapbox: vector tiles and geoJson. I use the latter in an OpenLayers browser app:</p>
  <pre><code>    var geoJSONFormat = new ol.format.GeoJSON();
      var gaugesSource = new ol.source.Vector({
          loader: function(extent, resolution, projection) {
              var url = 'http://myurl.org/gauges_geojson.php?bbox=' + extent.join(',');
              $.ajax({
                  url: url,
                  success: function(data) {
                      var features = geoJSONFormat.readFeatures(data);
                      gaugesSource.addFeatures(features);
                  }
              });
          },
          strategy: ol.loadingstrategy.bbox
      });
  </code></pre>
  <p>As the user pans or zooms the map, it calls the php script on my server. That php script then queries the PostGIS database using the bounding box in the URL parameters and returns the results using geoJson. Super simple!</p>
  <p>Is there a similar approach when working with Mapbox? There are plenty of geoJson examples on this website, but they mostly seem to come from a static geoJson file that gets loaded when the map loads. I will have way too much map data to load when my map is contains the entire US. There's <a href="https://docs.mapbox.com/mapbox-gl-js/example/live-geojson/" rel="nofollow noreferrer">an example</a> where a server sends a new location every x seconds, but that doesn't meet my use case. Vector tiles don't seem to be a great option because my data will change quite frequently. <a href="https://info.crunchydata.com/blog/dynamic-vector-tiles-from-postgis" rel="nofollow noreferrer">Crunchy Data's vector tile server</a> is a really great (and simple!) app, but it seems like there should be a way to do this with vector <em>data</em>, not tiles. And what if my data changes? How easy is it to reload a tile?</p>