-
Notifications
You must be signed in to change notification settings - Fork 180
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
queriesForRegion does not wrap regions #27
Comments
@jdimond - Can you take a look at this please? |
I've also been experiencing this problem for quite a while. The solution I use is to only update Geofire when the region is valid. The problem I come across is that when I am zoomed out and scroll to the north or south pole, there is an exception thrown in GFGeoHash.m on line 38. The call throwing this exception is in GFGeoHashQuery +queriesForRegion (line 178), when passing latitudeNorth (line 201) or latitudeSouth (line 205). It's always because these values are > 90 (north) or < -90 (south), which doesn't exist on a map. My problem is that when I call setRegion: on my Geofire query, the region comes directly from the mapView without any alterations, and Geofire should work for any region it's passed. Hope this helps you track down the problem. |
I arrived at the same conclusion as @austincarrig. I've written a gist which adds this region validation check as an extension to MKCoordinateRegion so you can just wrap your GeoFire queriesForRegion call in a |
Is there any workaround for returning all keys by distance from the current location, for locations existing globally? I've hit the same issue as @zgosalvez in #64 , and also tried to use It seems geofire-java supports a large radius? firebase/geofire-java#46 |
@ahaverty so I know this probably isn't official, but why not just attach a .childAdded event to the /user_locations endpoint in the database that GeoFire is working in? You're just read-only I assume so you shouldn't affect GeoFire's data integrity at all. That will get you all of the locations, which you can then sort by distance using a CLLocationDistance. You could even attach a .childChanged event to monitor changes in the list ordering. `import MapKit let location1 = CLLocation(latitude: 10, longitude: 100) |
@AJMiller Thanks for the suggestion. I've found an alternative workaround that shows my users an 'no nearby locations' screen, but would prefer to handle this using geofire like I have with the android version of geofire, as I can't guarantee geofire will work consistently across the world. Is this not an important bug, especially for anyone living near the north/south poles? |
I also have @austincarrig issue. Did someone find something ? If I use the @AJMiller extension, I lose some points on the map. |
I opened similar issue (#129) as GeoFire fails with a big radius. I have also tried using a region Query but it doesn't return all markers for my map when I zoom out to show the whole world. I'm assuming the same issues exist for Firestore? |
I created a simple project with an MKMapView, a GeoFire query and an MKMapViewDelegate, which updates GeoFire query region every time UIMapView region changes. But that crash with an unhandled
Not a valid geo location
exception, but only valid regions where used.The problem is that
queriesForRegion:region
is not wrapping locations when computing locations from regions. As a workaround I have to limit zoom on to MKMapView.The text was updated successfully, but these errors were encountered: