CBLView *view = [self.database viewNamed:@"taps"];
CBLGeoRect rect = (CBLGeoRect){{tapPoint.latitude - .0005, tapPoint.longitude - .0005}, {tapPoint.latitude + .0005, tapPoint.longitude + .0005} };
[view setMapBlock: MAPBLOCK({
id place = [doc objectForKey:@"geometry"];
if(place)
{
//NSLog(@"%@", place);
NSDictionary* temp = [doc valueForKeyPath:@"geometry.coordinates"];
//emit(CBLGeoJSONKey(doc[@"coordinates"]), doc[@"place"]);
NSLog(@"%@", temp);
emit(temp, doc[@"place"]);
}
}) version: @"1.0"];
CBLQuery* query = [[self.database viewNamed: @"taps"] createQuery];
//query.boundingBox = (CBLGeoRect){{tapPoint.latitude - .0005, tapPoint.longitude - .0005}, {tapPoint.latitude + .0005, tapPoint.longitude + .0005} };
query.boundingBox = (CBLGeoRect){{tapPoint.latitude + 5, tapPoint.longitude - 5}, {tapPoint.latitude + 5, tapPoint.longitude + 5} };
CBLQueryEnumerator *rowEnum = [query run: &error];
for (CBLGeoQueryRow* row in rowEnum)
{
NSLog(@"What did I find? ... %@", ((CBLGeoQueryRow*)row).geometry);
}