Skip to content
This repository has been archived by the owner on Dec 29, 2022. It is now read-only.

Max radius for queryAtLocation() #72

Closed
m6s opened this issue Jun 21, 2017 · 8 comments
Closed

Max radius for queryAtLocation() #72

m6s opened this issue Jun 21, 2017 · 8 comments

Comments

@m6s
Copy link

m6s commented Jun 21, 2017

Through trial and error I've found that the max radius for which query results are returned is about 8587km. For bigger radiuses, onKeyEntered() is never called. Is that a bug? If not, how would I go about querying locations that are further apart? I'm using GeoFire 2.1.1 on Android.

    @Test
    public void queryAtLocation() throws InterruptedException {
        double radius = 8589; // Fails
//        double radius = 8587.8; //Passes
        CountDownLatch latch = new CountDownLatch(1);
        final boolean[] entered = {false};
        geoFire.queryAtLocation(new GeoLocation(0, 0), radius)
                .addGeoQueryEventListener(new GeoQueryEventListener() {
                    @Override
                    public void onKeyEntered(String key, GeoLocation location) {
                        entered[0] = true;
                    }

                    @Override
                    public void onKeyExited(String key) {
                    }

                    @Override
                    public void onKeyMoved(String key, GeoLocation location) {
                    }

                    @Override
                    public void onGeoQueryReady() {
                        latch.countDown();
                    }

                    @Override
                    public void onGeoQueryError(DatabaseError error) {
                    }
                });
        latch.await();
        Assert.assertTrue(entered[0]);
    }
@braulio94
Copy link

Facing the same issue.

@vanniktech
Copy link
Contributor

Let's go and throw an error when the passed radius is too big too handle?

@samtstern
Copy link
Contributor

@vanniktech that's a great idea, or at least a sternly-worded Log message.

@vanniktech
Copy link
Contributor

Another possible solution is to max it internally and state in the javadoc that we'll not go higher than 8589.

Which one should we go for?

@samtstern
Copy link
Contributor

@vanniktech I think that's least harmful, and we can still do big warnings in the log whenever we get a bigger radius.

@vanniktech
Copy link
Contributor

I'll do this tomorrow then.

@ahaverty
Copy link

This sounds like a different bug if 8589km is working for a few people, but just incase the cause is linked and ye haven't seen this on the objective-c project: firebase/geofire-objc#64

@samtstern
Copy link
Contributor

This issue was fixed and released in v2.2.0.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants