function findBounds(cb) {
    let numAddresses = document.getElementById('numAddresses').value;
    coords = []; // empty it each time
    let bounds = map.getBounds().toArray().flat();
    // make seven coordinates
    let controls = turf.randomPoint(numAddresses, {bbox: bounds});
    controls.features.forEach(function(control, index) {
        coords.push(control.geometry.coordinates);
        baseClient
            .reverseGeocode({
                query: control.geometry.coordinates,
                limit: 1,
                mode:'mapbox.places'
            })
            .send()
            .then(response => {
                const match = response.body;
                document.getElementById('addresses').innerHTML += match.features[0].place_name + '\n';
            });  
    });
    console.log(controls);
    cb(controls);
}
// start with getting a set of random points with turf
start with getting a set of random points with turf
start with getting a set of random points with turf
function findBounds(cb) {
    let numAddresses = document.getElementById('numAddresses').value;
    coords = []; 
    let bounds = map.getBounds().toArray().flat();
    let controls = turf.randomPoint(numAddresses, {bbox: bounds});
    controls.features.forEach(function(control, index) {
        coords.push(control.geometry.coordinates);
        baseClient
            .reverseGeocode({
                query: control.geometry.coordinates,
                limit: 1,
                mode:'mapbox.places'
            })
            .send()
            .then(response => {
                const match = response.body;
                document.getElementById('addresses').innerHTML += match.features[0].place_name + '\n';
            });  
    });
    console.log(controls);
    cb(controls);
}
function findBounds ( cb ) { let numAddresses = document . getElementById ( 'numAddresses' ) . value ; coords = [ ] ; let bounds = map . getBounds ( ) . toArray ( ) . flat ( ) ; let controls = turf . randomPoint ( numAddresses , { bbox : bounds } ) ; controls . features . forEach ( function ( control , index ) { coords . push ( control . geometry . coordinates ) ; baseClient . reverseGeocode ( { query : control . geometry . coordinates , limit : 1 , mode : 'mapbox.places' } ) . send ( ) . then ( response => { const match = response . body ; document . getElementById ( 'addresses' ) . innerHTML += match . features [ 0 ] . place_name + '\n' ; } ) ; } ) ; console . log ( controls ) ; cb ( controls ) ; }
start with getting a set of random points with turf
start with getting a set of random points with turf
// empty it each time // make seven coordinates