typedef struct {
CLLocationDegrees latitudeDelta;
CLLocationDegrees longitudeDelta;
} MKCoordinateSpan;
typedef struct {
CLLocationCoordinate2D center;
MKCoordinateSpan span;
} MKCoordinateRegion;
Does anyone know how I can convert that to a CBLGeoRect?
Thanks,
Brendan
--
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 mobile-couchba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mobile-couchbase/49442b61-7c86-4edb-b8a8-9167a17b1ecc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
emit(CBLGeoPointKey([locationData[@"lat"] doubleValue], [locationData[@"lon"] doubleValue]),
nil);
emit(CBLGeoPointKey([locationData[@"lon"] doubleValue], [locationData[@"lat"] doubleValue]),
nil);
And my routine to convert from my MKCoordinateRegion to a CBLGeoRect is this:
- (CBLGeoRect)geoRectForCoordinateRegion:(MKCoordinateRegion)region {
CLLocationCoordinate2D bottomLeftCoordinate =
CLLocationCoordinate2DMake(region.center.longitude - (region.span.longitudeDelta/2.0),
region.center.latitude - (region.span.latitudeDelta/2.0));
CLLocationCoordinate2D topRightCoordinate =
CLLocationCoordinate2DMake(region.center.longitude + (region.span.longitudeDelta/2.0),
region.center.latitude + (region.span.latitudeDelta/2.0));
CBLGeoPoint minPoint = (CBLGeoPoint){bottomLeftCoordinate.latitude, bottomLeftCoordinate.longitude};
CBLGeoPoint maxPoint = (CBLGeoPoint){topRightCoordinate.latitude, topRightCoordinate.longitude};
CBLGeoRect bbox = (CBLGeoRect){minPoint, maxPoint};
TFFLog(@"bbox 2: min.x: %f, min.y: %f, max.x: %f, max.y: %f", minPoint.x, minPoint.y, maxPoint.x, maxPoint.y);
return bbox;
}