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

327
Views
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
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!