rethinkdb / horizon

Horizon is a realtime, open-source backend for JavaScript apps.
MIT License
6.78k stars 351 forks source link

Spec out and build a geolocation API #5

Open coffeemug opened 8 years ago

coffeemug commented 8 years ago

TBD

peterlandry commented 8 years ago

This is something I'd be willing/able to chip in on, I'm wondering if there's any information about goals or requirements that could help me get involved? I don't want to make more work for you on a feature that's in medium term, but if there's any groundwork I can help lay I'd be glad to.

danielmewes commented 8 years ago

Thanks for offering your help with this @peterlandry .

The geolocation API is still largely unspecified. The fundamental operation that we would like to provide is an operation to

The first step will be to spec out an API proposal of how this functionality should be presented in the Horizon client API.

There are also going to be some technical limitations that we will have to consider for. The most important one I can think of is that RethinkDB doesn't currently support compound geospatial indexes. So if we want to allow queries that query by radius and also apply additional filtering, the filtering will not be optimized by an index. I think that might be ok, but it might also have implications for scalability and susceptibility to DoS attacks. If on the other hand we don't allow for additional filters on a geo query result and rely on any post-filtering to be implemented in the client, that will have implications for Horizon's permission model. It will not be possible to limit access to geospatial data based on additional field values.

danvass commented 8 years ago

@danielmewes Is there any way to currently work with location and filtering based on distance from a specific location?

danielmewes commented 8 years ago

@DVassilev None that's exposed through Horizon. On bare RethinkDB, you can use r.table(...).getIntersecting(r.circle(location, distance), {index: "geo_index..."}) to do this.