Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Internal State error, trying to remove location that is still in query #133

Open
Youdaman opened this issue Jan 30, 2017 · 8 comments
Open

Comments

@Youdaman
Copy link

Took me a while to reproduce this on the example, but here's a screenshot:

screenshot 2017-01-30 21 40 26

To reproduce, visit https://geofire.firebaseapp.com/queryBuilder/index.html and create a fish with latlng 34.0489281,-111.09373110000001 then create a query with radius 10000 and latlng 43.92630646953202,127.05690366562499 then update the query with latlng 43.16183777054158,-116.57590883437501 and then revert it back to latlng 43.92630646953202,127.05690366562499 and update it few times and it throws the error:

"Internal State error, trying to remove location that is still in query"

Now my wild guess as to why this happens is that the earth has a diameter of 12742km and so the biggest search radius should be half that. I tried drawing a circle on Google Maps and with the same radius as the query and depending where the center is and how far you're zoomed out you get a sine wave as opposed to a circle, and so I can only guess that when the search radius is too big you end up with an "overlap" or maybe a situation where a key is both in and out of the search circle at the same time. Again, this is only a guess.

I'd love a way to overcome this problem, and my current "solution" is based on my wild guess where I limit the size of the query radius to 6371km (half the diameter of the world to avoid circle overlap).

@Youdaman
Copy link
Author

Another related question, is it possible to search via the northeast/southwest bounding coordinates instead of a radius? This would make more sense when using GeoFire with a map.

Currently I'm grabbing the center of the map, then one of the corners and then using the distance between those two points as the radius of my search query -- with the only problem being needing to manually filter out results that are outside the borders of the map but still within the query circle.

I think CouchDB has some geo stuff that uses a bounding box instead of a circle?

@mb040574
Copy link

mb040574 commented Aug 4, 2017

Was anything done to this bug??

@kasterlod
Copy link

query radius to 6371km but still getting error. I temporarily hide this error throwing (and works!) but in the near future I will try to find solution (https://github.com/kasterlod/geofire-js)

@Fab-z4qx
Copy link

I have this error too, even if the radius is < 6000km.

@kasterlod how did you catch this exception ?

@filipef101
Copy link

bump

@filipef101
Copy link

facing the same, any solution?

@jfhidakatsu
Copy link

jfhidakatsu commented Jun 29, 2018

I've had this problem as well at radius 6000. I put it down to radius 5000 and so far, I haven't seen the problem again.

@jfhidakatsu
Copy link

I think I finally solved this issue in my case, though this may or may not apply to other cases. For me, it was simply because I didn't call cancel on the geoquery (not just onKeyEntered type calls, but the entire query like geoquery.cancel()). My use case was using geoquery in a firebase cloud function, and GeoFire was still trying to do things after the function finished.

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

No branches or pull requests

7 participants