Skip to content

Issues displaying OpenWeatherMap with leaflet

I am practicing on a simple weather app using OWM. I am fetching the coordinates and pass them to a function to display a map using leaflet.

Here is my code

function drawMap(lat,lon){

    const mymap ='map').setView([lat, lon],3);



My issues are :

-Zoom level is required by leaflet but it’s also in the openweather URL so i don’t know if i need to put the same or not -in the url, i’m supposed to put x and y tile coordinates , I don’t really understand the required X and Y values and the OWM API doc doesn’t really elaborate on those.

Right now , using the values 3/6/1 for example, i get Result

The zoom is just the same tiles over and over and you can’t make out anything so obviously I’m doing something wrong



I don’t really understand what you are describing but normaly you would set template strings in the Tile-Url that can are replaced by leaflet: