assets/js/script.js
// [Nominatim] Coordinates for User Input
[Nominatim] Coordinates for User Input
[ Nominatim ] Coordinates for User Input
function coordinatesLookup (url, city) {    
    fetch(url + city)                       
    .then(res => res.json())                
    .then(function (data) {                 
        let lat = data[0].lat;
        let lon = data[0].lon;
        const weatherUrl = `https://api.openweathermap.org/data/2.5/onecall?lat=${lat}&lon=${lon}&units=metric&appid=${apiKey}`;    
        weatherLookup(weatherUrl);            
    })
}
function coordinatesLookup ( url , city ) { fetch ( url + city ) . then ( res => res . json ( ) ) . then ( function ( data ) { let lat = data [ 0 ] . lat ; let lon = data [ 0 ] . lon ; const weatherUrl = ` ${ lat } ${ lon } ${ apiKey } ` ; weatherLookup ( weatherUrl ) ; } ) }
[Nominatim] Coordinates for User Input
[ Nominatim ] Coordinates for User Input
// Passed in NominatimUrl and user input // Call the Nominatim Api with the completed url // Return the JSON response // Extract the Latitude and Longitude of the user input city // Template Literal for API call construction // Call the Open Weather Api with the returned Latitude and Longitude values input into the API call