Porting geocouch couchdb1.3.x in refuge_spatial (without knn for now).