firebase / geofire-java

GeoFire for Java - Realtime location queries with Firebase
MIT License
670 stars 271 forks source link

only keys with positive longitude are returned if center has positive longitude, same with positive. #148

Open ChristopheVersieux opened 5 years ago

ChristopheVersieux commented 5 years ago

Hello

I am facing a really weird bug. I am currently querying some geofire events with Android, and I noticed after some wasted hours of search that the geoquery returned only items with positive longitude, and not the one with negative longitude that is closed.

My code:

//FORCING LONGITUDE FOR TESTING
lastLoc.setLongitude(0.000000001);
//lastLoc.setLongitude(-0.000000001);

                Log.d("CVE", "QUERY at "+lastLoc.getLatitude()+","+lastLoc.getLongitude());
                geoFire.queryAtLocation(new GeoLocation(lastLoc.getLatitude(), lastLoc.getLongitude()), 6000.0d).addGeoQueryEventListener(new GeoQueryEventListener() {
                    @Override
                    public void onKeyEntered(final String key, final GeoLocation location) {
                        i++;
                        Log.e("CVE", i+"");

Notice the forcing at the beginning of the code.

The first case will return 12 items with positive longitude The second one will return the only one with negative longitude

Here is an example of the data I query:

capture

EDIT, iOS dev has same issue:

2019-02-26 21:55:10.753212+0100 Wakademy[5653:72281] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Not a valid geo location: [92.855914,4.244083]'

Seems related with the point with negative values as we can see below

ChristopheVersieux commented 5 years ago

Funny thing, it seems that the error comes if I query something greater than 3000 km

I will try to give you an exact value if I have some findings

image

EDIT:

Value is close to 3759 image