Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

260
Views
Leaflet Markercluster con GeoJson y Leaflet Ajax

Haciendo referencia a los ejemplos en una pregunta anterior: Leaflet MarkerCluster con GeoJson

Estoy tratando de usar markercluster con folleto después de que se hayan cargado los datos de geojson, puedo ver que los datos se están cargando junto con los marcadores de markercluster de la consola, pero parece que el mapa final.addLayer está fallando, el navegador parece colgarse cuando llega a este punto.

Puedo cargar y mostrar los puntos del mapa después de cargar el geojson con geojsonAjax.addTo(mapa); así que esta parte está funcionando.

la biblioteca de folletos y los complementos se cargan en el siguiente orden:

 leaflet.js leaflet.ajax.min.js leaflet.markercluster.js // Add basemap tiles and attribution. var OpenStreetMap_Mapnik = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { maxZoom: 19, attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors' }); // Create map and set center and zoom. var map = L.map('map', { scrollWheelZoom: false, center: [47.5, 10], zoom: 5 }); // Add basemap to map. map.addLayer(OpenStreetMap_Mapnik); var geojsonAjax = new L.GeoJSON.AJAX("/campaign-results/geojson", { pointToLayer: function(feature, latlng) { return new L.marker(latlng); }, }); //geojsonAjax.addTo(map); //map.addLayer(geojsonAjax); //console.log("data loaded:", geojsonAjax); var markers = L.markerClusterGroup() //geojson ajax listener geojsonAjax.on('data:loaded', function () { // Add the cluster data after the geojson layer has loaded. markers.addLayer(geojsonAjax); console.log("add markers:", markers); map.addLayer(markers); });
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!