firebase / firebase/geofire-js
Large radius query returns different results for small amounts either side of the meridian
- Dominant language
- TypeScript
- Stars
- 1.4k
- Forks
- 339
- PR merge metrics
- No merged PRs in 30d
Description
In investigating some strange behaviour in a map rendered from geofire I noticed this following strange behaviour.
For a query with a radius equal or over 8,587,850, at the equator, moving the longitude a tiny amount to the other side of the meridian returns a different set of results. For higher/lower latitudes the critical radius is lower e.g. at 55 degrees latitude a radius of 3,342,783 passes and 3,342,784 fails. I wrote the below test case to demonstrate the problem.
I'm out of time to investigate this further as we're using a different approach but I hope this partial write-up might be useful to the team.
```
it('Query bounds from geohashQueryBounds must work across the meridian with big radius', () => {
const centerLat = 0;
const centerLong = 0.00000001;
const radius = 8_587_850; // fails
// const radius = 8_587_849; // passes
const queriesEast = geohashQueryBounds([centerLat, centerLong], radius);
const queriesWest = geohashQueryBounds([centerLat, -centerLong], radius);
expect(queriesEast).to.have.deep.members(queriesWest);
});
```
Contributor guide
Research direction
Start with the geohashQueryBounds implementation and run the issue's test case at the stated equatorial radius, comparing results for centerLong 0.00000001 and -0.00000001. Investigate the latitude-dependent boundary behavior; done means both sides of the meridian produce equivalent query bounds for the reported large-radius cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- backend-api-design
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100