Geo Spacial Bounding Box Rectangle Calculation Error: Latitude Incorrect

后端 未结 3 870
南方客
南方客 2020-12-28 10:47

Can any trig or GPS experts help me out here? I\'m trying to create a geo-spacial bounding box (rectangle) calculation returning the maximum latitude and longitude using the

3条回答
  •  醉话见心
    2020-12-28 11:33

    How are you guys setting up the NSPredicates?

    I seem to run into performance issues with mine.

    NSPredicate *northWestLat = [NSPredicate predicateWithFormat:@"ANY locations.lat > %lf", northWestCorner.latitude];
    NSPredicate *southhWestLat = [NSPredicate predicateWithFormat:@"ANY locations.lat < %lf", southEastCorner.latitude];
    NSPredicate *latitudePredicate = [NSCompoundPredicate andPredicateWithSubpredicates:[NSArray arrayWithObjects:northWestLat, southhWestLat, nil]];
    
    NSPredicate *northWestLng = [NSPredicate predicateWithFormat:@"ANY locations.lng < %lf", northWestCorner.longitude];
    NSPredicate *southEastLng = [NSPredicate predicateWithFormat:@"ANY locations.lng > %lf", southEastCorner.longitude];
    NSPredicate *longitudePredicate = [NSCompoundPredicate andPredicateWithSubpredicates:[NSArray arrayWithObjects:northWestLng, southEastLng, nil]];
    
    NSPredicate *coordPredicate = [NSCompoundPredicate andPredicateWithSubpredicates:[NSArray arrayWithObjects:latitudePredicate, longitudePredicate, nil]];
    

提交回复
热议问题