I have a sqlite database with about 100 000 rows containing longitudes and latitudes of ATMs. I want to display this ATMs by pins on MKMapView. But I think that it is not good for memory and not o fast if I will load all coordinates from DB at once. What is the best way to do it?
I have a sqlite database with about 100 000 rows containing longitudes and latitudes
Share
You’re absolutely right, don’t load them all at once!
Use a bounding box to only get coordinates that are within the map your want to display. Check out the answer to this question : Core Data and Core Location
Use the same concept of a upper and lower limit to your lat and lng to only return rows from sqlite that are currently visible. Your query would look something like
This query only returns ATMs that are near central London (51.5, -0.17).