Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6744595
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:06:09+00:00 2026-05-26T12:06:09+00:00

I have a huge core data database of longitudes and latitudes for paths on

  • 0

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 …).

Data Model

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T12:06:10+00:00Added an answer on May 26, 2026 at 12:06 pm
    1. You could speed up the query by storing the min/max values in your Way entity as scaled integers instead of floats. Pick a scaling factor that gives you an acceptable area resolution, use it to prescale the values when you store them and use the same scale factor when you do the query.

    2. You could also look at adding a quadtree data structure to your core data model to home in on Ways in the desired area.

    3. SQlite will bail out at the first test that fails in a compound predicate so put the cheapest test first.

    4. Also look at enabling indexing for those 4 attributes.

    To be honest though, I’m surprised that this is slow. How many total Ways do you have in your database and how many typically in an area that you want to query?

    Have you tried turning on SQL debugging to see what query is actually run against the database? (hint: add -com.apple.CoreData.SQLDebug 1 as a command line argument in your Scheme editor for the Run behaviour)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have huge data which is static. I need to save it within the
I have huge amont of geographic data represented in simple object structure consisting only
I have a fairly complex Core Data database with many entities, attributes and relationships.
I have huge amount of txt files which contains 64x64 matrices consisting of integers.
I have a huge access mdb file which contains a single table with 20-30
I have a huge MySQL table which has its rows encoded in UTF-8 twice.
I have a huge project (Application) with another project inside it (Core). Application has
I have the requirement to read/search the huge amount of data from CoreData API.
i have a huge CU file which contains my project , im trying to
We are using mysql. We have a huge table which contains 1 billion rows.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.