firebase / geofire-java

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

Query keys within an arbitrary shape? #17

Open janakagamini opened 8 years ago

janakagamini commented 8 years ago

This might be a stretch, but in addition to querying for keys within a radius, will it be possible (in the future perhaps) to query for keys within an arbitrary shape (possibly defined as a list of GeoLocations)?

E.g. usage: Check if a point is within a certain city (given that I know a list of GeoLocations that outlines the city).

jwngr commented 8 years ago

Thanks for the feature request! It is pretty much equivalent to https://github.com/firebase/geofire-js/issues/46. Unfortunately, I don't see this happening any time soon unless someone from the community wants to take a crack at it and send us a PR.

janakagamini commented 8 years ago

Yes, exactly that. I'll give it a try. From a cursory glance at the code it seems I should probably be looking at private boolean locationIsInQuery(GeoLocation location) @ GeoQuery.java

Shout out if I'm way off. Thanks :)

jwngr commented 8 years ago

Yup, that is the right place. Thanks for taking a crack at this!

A couple notes:

janakagamini commented 8 years ago

Thanks for the tips jwngr, I will certainly try, but I can't guarantee anything.

vanniktech commented 6 years ago

The objective C implementaton for geofire has support for bounding boxes AFAIK.

samtstern commented 6 years ago

@vanniktech that's good to know. We can use that code as a reference.

samtstern commented 6 years ago

I think it would be reasonable to try and support bounding boxes, but I don't think we should get into the math of doing arbitrary polygonal geo computations in this library. It's probably much better for everyone to just use a bounding box and then use some client-side logic to narrow that down to the polygon.

vanniktech commented 6 years ago

Totally agree, bounding box and circular shape should be good enough.