index.js
/**
 * Iterate through each item in the spreadsheet and attempt to geocode it,
 * with addGeocodedMarker as the callback.
 */
Iterate through each item in the spreadsheet and attempt to geocode it,
with addGeocodedMarker as the callback.
Iterate through each item in the spreadsheet and attempt to geocode it with addGeocodedMarker as the callback .
function geocodeData(data, tabletop) {
    for(var row = 0; row < data.length; row++) {
        if (data[row].Lat && data[row].Lng) {
            latlng = [data[row].Lat, data[row].Lng]
            addMarker(latlng, data[row])
        } else {
            geocoder.query({
                query: data[row].Name + ", " + data[row].Address + ", Barcelona",
                country: 'es',
                proximity: L.latLng(41.4, 2.16),
            }, addGeocodedMarker(data[row]));
        }
    }
}
function geocodeData ( data , tabletop ) { for ( var row = 0 ; row < data . length ; row ++ ) { if ( data [ row ] . Lat && data [ row ] . Lng ) { latlng = [ data [ row ] . Lat , data [ row ] . Lng ] addMarker ( latlng , data [ row ] ) } else { geocoder . query ( { query : data [ row ] . Name + ", " + data [ row ] . Address + ", Barcelona" , country : 'es' , proximity : L . latLng ( 41.4 , 2.16 ) , } , addGeocodedMarker ( data [ row ] ) ) ; } } }
Iterate through each item in the spreadsheet and attempt to geocode it,
 with addGeocodedMarker as the callback.
Iterate through each item in the spreadsheet and attempt to geocode it with addGeocodedMarker as the callback .
// If the row already has Lat and Lng data attached, go straight to addMarker // Otherwise we need to use the MapBox geocoder to get coordinates.