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

229
Views
Mapbox queryRenderedFeatures does not work as expected with bbox

I would like to get all features within a drawn polygon. In order to avoid iterating over all features of my layer, I constrain the queried features with a bbox. I calculate the bbox with the turf library.

However, the returned features do not correspond to the required bbox.

Attached you can see in the picture:

  • In blue: the calculated bbox
  • in red: the returned features from the queryRenderedFeatures() query.

Selected Features in bbox

import bbox from '@turf/bbox';

const bboxGeom = bbox(drawGeometry);

// convert to pixels for queryRenderedFeatures()
const southWest = map.project([bboxGeom[0], bboxGeom[1]]);
const northEast = map.project([bboxGeom[2], bboxGeom[3]]);
const box = [[southWest.x, southWest.y], [northEast.x, northEast.y]];
const features = map.queryRenderedFeatures(
   box, { layers: ['myLayer'] },
);
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!