Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

265
Vistas
LeafletJS map not working properly. Shows zoomed out world map

I am fetching certain data from the geolocation API and displaying information about a particular IP address entered by the user. I'm also displaying the location using Leaflet.js but the map doesn't work properly. I am fetching the coordinates from the API and updating the center of the map with them.

Here's a screenshot

The JS code looks like this:

map = L.map('map').setView([lat, long], 13);

L.tileLayer('https://api.mapbox.com/styles/v1/mapbox/streets-v11/tiles/0/0/0?access_token='+ACCESS_TOKEN, {
    attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, Imagery © <a href="https://www.mapbox.com/">Mapbox</a>',
    maxZoom: 18,
    id: 'mapbox/streets-v11',
    tileSize: 1024,
    zoomOffset: -1,
    accessToken: ACCESS_TOKEN
    }).addTo(map);

L.marker([lat, long]).addTo(map)
    .bindPopup("popup")
    .openPopup();

What might be wrong?

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda