Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

141
Visualizações
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 = L.map('map').setView([lat, lon],3);

    L.tileLayer(`https://tile.openweathermap.org/map/temp_new/3/1/1.png?appid=${apiKey}`).addTo(mymap);

}

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

Thanks

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

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:

L.tileLayer(`https://tile.openweathermap.org/map/temp_new/{z}/{x}/{y}.png?appid=${apiKey}`).addTo(mymap);
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda