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

170
Views
How to find all S2 cells within a specified level within a boundary in JavaScript?

I have a Google Map, and I want to show all of the cells of a specified level on the map. I don't have a problem with the map, and I can already draw the polygon for any cell at a specific coordinate.

But I'm not sure how to find all of the cells within the map boundary. I can start with the center coordinates, or with the southwest or northeast coordinates, but how do I find all of the cells that are completely or partially within the map boundary?

I tried to use the getNeighbors() method but I get an error and haven't been able to get past it (this.face is undefined).

I tried the .move() method, starting with the center coordinates, to find all the cells that have any corner coordinate within the map boundary, but I've been unsuccessful in discovering all of the cells.

Perhaps starting at one corner and going in horizontal rows using the move() method, and then moving down a row and starting over when a cell is completely not in the boundary?

I figure there must be a smarter way, or a different/more supported S2 library to use?

I'm using this library in JavaScript: https://www.npmjs.com/package/@raha.group/s2-geometry/v/1.0.7

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!