Queries++ in RavenDBSpatial searches

time to read 2 min | 221 words

Spatial queries are fun, when you look at them from the outside. Not so fun when you are working to implement them, but that is probably not your concern.

RavenDB had had support for spatial queries for many years now, but the RavenDB 4.0 release has touched on that as well and now you can query spatial data with much greater each. Here is a small sample of how this works:

This query is doing a polygon search for all the employees located inside that polygon. You can visualize the query on the map, we have 4 employees (in yellow) in the viewport and two of them are included within the specified polygon (in blue).


And here is what this looks like in the studio:


In this case, you can see how we support automatic indexing of spatial data. You can also define your own spatial indexes if you need greater control but it is as easy as pie to just go ahead and start running it.

From code, this is just as easy:

I’m not sure why, but when looking at the results, this just feels like magic.

More posts in "Queries++ in RavenDB" series:

  1. (18 Dec 2017) Spatial searches
  2. (15 Dec 2017) I suggest you can do better
  3. (11 Dec 2017) Gimme more like this
  4. (07 Dec 2017) Facets of information