I have a huge core data database of longitudes and latitudes for paths on a map.
I have an object called a way which consists of an ordered set of Nodes (lon,lat). I also store the enclosing box around the way (minLon, minLat, maxLon, maxLat ...).

My query finds all the ways in a particular region of the map:
NSPredicate *predicate = [NSPredicate predicateWithFormat:
@"minLon < %f AND maxLon > %f AND minLat < %f AND maxLat > %f",
maxLon, minLon, maxLat, minLat];
Its dam slow!
My idea to speed up the query is to split the data by square regions somehow (Multiple tables? Multiple .sqllite files? Create a hash of the location?) so there is less data to search though.
How can I do this?