Open sauravbiswasiupr opened 10 years ago
Hey @sauravbiswasiupr, mind sharing your use case? We have considered adding rectangular GeoQueries
but didn't think there was enough demand for them. I'm interested to hear your thoughts though.
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: http://s.codepen.io/stevepepple/debug/ByVyYX?
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
:+1:
@gigablox , great suggestion.
Hi @jwngr , we are urrently at the Launch Hackathon, and we could use this feature. Can't you go visit your Google Maps colleagues and ask them how to do it? There a many geodata application which could use this feature.
What about support for polygon based geoQueries ? The current API seems to provide support only for circular geoQueries.