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

333
Vistas
Efficiently draw turfjs square grid on world map

My requirement is to divide whole world map into square grid using mapbox and turf.js. User will always view visible part of grid in his/her map viewport/bounds. The concept of drawing grid on world map is there because I thought that we will draw whole grid at once and user will see in map viewport by using mask option in turf square grid. But problem is that the grid is not visible when I am trying to draw it on world map using :

grid = turf.squareGrid([-179.99, -89.99, 179.99, 89.99], 100, {units: 'meters'})

and when I am drawing the grid only on the user's map viewport then on map drag/move, using following code

const bounds = map.getBounds();
        
const NE = bounds.getNorthEast();
const SW = bounds.getSouthWest();
var options = {units: 'meters'};
var grid = turf.squareGrid([SW.lng, SW.lat, NE.lng, NE.lat], 10, options);

I redrawn the grid again and places of grid cells and their id's have been changed.

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