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

309
Visualizações
make leaflet offline map (use local map tiles) but nothing shows up

it's work on leaflet online map like this

<script>
import L from 'leaflet';
export default {
mounted() {

var map = L.map('map').setView([25.042474, 121.513729], 13);
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
  maxZoom: 13,
  minZoom:2
}).addTo(map);

},
};
</script>

when i try to make map tiles locally then nothing show up on html ( using MobileAtlasCreator make map tiles)

<script>
import L from 'leaflet';
export default {
mounted() {

var map = L.map('map').setView([25.042474, 121.513729], 13);
L.tileLayer('./img/mapTiles/{z}/{x}/{y}.png', {
maxZoom: 13,
minZoom:2
}).addTo(map);

},
};
</script>

this is my reference below

HTML offline map with local tiles via Leaflet

https://www.youtube.com/watch?v=oP4bCLtXIeY

thanks a lot

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

0

Since you are planning to work (or use it afterwards) in a local environment, I would take out the import snippet from the code. It's mounted, I get it; but just work locally, after you get those tiles downloaded. Put them in a folder, and load them using the code you have. Your code is fine! Here is my example:

    var m = {x: 41.892594, y: 12.484371};
    var SELF_Map = L.tileLayer('empire/{z}/{x}/{y}.jpg', {
        //attribution: 'none',
        continuousWorld: false,
        minZoom: 4,
        maxZoom: 10,
        tap: false
    }).addTo(map);
    map.setView({lat: m.x, lng: m.y}, 6);

It worked for me every time. I get the images from my favorite map provider, I download them, and store them in a folder, in this case, a folder called "empire".

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