Enter code here...
Hello there - first timer here, great group you have. Thanks in advance for
taking the time out to help!
I'm trying to get a set of coordinates that are stuck in a geoJSON
formatted document in the CBL database to compare themselves to a tapped
point on a map, but it's just not working for me. I've tried changing the
bounding coordinates of the map, the emitted keys (I tried the coordinates
themselves, and then just the geoJSON geometry tag itself), but nothing is
ever enumerated for me to iterate over, which I'm supposing means there is
nothing found. Any idea what I'm doing wrong?
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);
}
--
You received this message because you are subscribed to the Google Groups
"Couchbase Mobile" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/mobile-couchbase/29ff270a-d23f-411d-b9a9-bbb53944fe45%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.