I have a set of documents in CouchDB that are geolocalized - that is, they have a structure like
{
_id: ...,
...
coords: {
lat: 45.204149214,
long: 40.284712972
}
}
I want to be able to display them on a map. This requires me to get all documents in a given square. It is easy to get all documents with longitude in a given interval:
// map function
function(doc) {
emit(doc.coords.long, doc.other_stuff);
}
using a query like
// query
/path/to/view/?startkey=40&endkey=50
The problem is that I do not see how to do multidimensional constraints. How to get all documents with latitude between, say, 20 and 30 and longitude between 40 and 50? I see I can specify multiple keys, but that will or the results.
One option would be to do further filtering on the client, but given the size of the data, this may be unfeasible.
Disclaimer: there are a few similar questions on SO, basically stating that this is not possible. Since they all look dated, I would like to know whether something has changed in the latest releases of CouchDB.