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

219
Visualizações
Error 404 when loading a .geojson file in a web application (leaflet, ajax)

I'm learning how to build GIS web applications, and I'm getting an HTTP Error 404.3 - Not Found trying to load a geojson file into a map built with leaflet. I'w checking the map directly online in my website

In I have inserted this tag that calls the AJAX file:

The script is:

 var geojsonLayer = new L.GeoJSON.AJAX('/.../data/attractions.geojson', {pointToLayer: function(feature, latlng) {
                var str = "<h4>"+feature.properties.name+"</h4><hr>";
                str += "<a href='"+feature.properties.web+"' target='blank'>";
                str += "<img src='img/"+feature.properties.image+"' width='200px'>";
                str += "</a>";
                return L.marker(latlng).bindPopup(str);
            }});
 geojsonLayer.addTo(mymap);

Everything is right, but I read this error loading my geojson.

I think the problem is with the geojson file extension, but I don't know how I can handle it. I use a windows hosting through Aruba. The file is not damaged (I tried to open it on Qgis without problems)

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

0

I just fixed the problem, I hope to help someone to save time since I lost hours today.

Basically, you just need to replace ".geojson" with ".json" (without changing the file extension).

I do not understand why, and if you have the answer please let me now, but now it works.

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