-
Notifications
You must be signed in to change notification settings - Fork 347
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
Polygon shaped geoqueries #46
Comments
Hey @sauravbiswasiupr, mind sharing your use case? We have considered adding rectangular |
I too would like polygon search and not just rectangular. I want to draw a polygon around a specific neighborhood and find only data in that polygon for example. Also I would think rectangular search would be needed in the vast majority of apps that simply want to display data on the current map which is always rectangular. If polygon search is too hard I could try using https://github.com/firebase/flashlight for polygon search but would much prefer geofire. |
Hi @jwngr , sorry for the late reply. Basically consider searching for some location ( lat, lon) that lies inside a polygon of n sides, where n is a finite number. Like @jeffcjohnson mentioned, basically you could draw a polygon of n sides ( say 4 ) on the map, and get a list of vehicles ( or data that you might have stored), in the callback. I think this feature would be pretty cool. |
Thanks for the feedback guys. Polygon-shaped geoqueries are going to be tricky! I think we will most likely implement rectangular geoqueries in the next major release, but I'm not sure exactly how we would implement arbitrary polygon queries. We will definitely need to go back to the drawing board on that one. If this is really something you want to see, this is an open source project and I would be more than happy to review some code you submit. This is definitely not a small thing to add, but if you need it/want to see it, feel free to throw some code around. I can answer any questions about the code that you have. I'll keep this issue open until we add some more query types. |
I need to do polygon-based geoqueries too. What do you think if we reduce this problem to:
|
I think that kind of solution would work well in the average case. I unfortunately don't think I'll have a chance to implement this kind of functionality any time soon, but I would gladly review any PRs that come my way. |
Here's an example of how to use Turf.js for reducing a query to a rectangle or polygon shape. Seems like this technique would work well in the Geofire library: Another option would be to take the area of your polygon (or the "extent" of the feature) and create a circle (query) around it. |
You guys are talking about a Ray-Casting algorithm found in Google Maps JS API - aka "point in polygon". I agree a feature like this would be absolutely killer. https://developers.google.com/maps/documentation/javascript/examples/poly-containsLocation |
👍 |
What about support for polygon based geoQueries ? The current API seems to provide support only for circular geoQueries.
The text was updated successfully, but these errors were encountered: