views:

278

answers:

1

Hi. I'm about to build an app that has a database of places that has a location (lon/lat) and i'm about to build the dataModel. Actualy the app is very simple and all i want is to be able to fetch all places around the user (say in a radius of 30miles).

Is it better to user SQLite (is there any geo-spatial extension out there)?

I'll have around 5000 places in the database and i'm wondering where i can ask a database without affecting performances.

+1  A: 

I would go with CoreData for performance issues. CoreData is all good when doing single operations like reading or inserting records to the store but when doing bulk operations fails since you have to iterate thru all objects to do an update or a delete.

SQLite on the other hand is a little bit more slower but faster than CoreData in bulk operations.

I have my apps using CoreData with 8k+ entries and I don't have problems. The only problem I encountered was when doing bulk operations and I updated my app to use SQLite on the data that needed to be updated in bulk.

You can also access SQLite using CoreData.

JeremySpouken
Hmmm.Sound interesting.how can one access to SQLite using CoreData?on the other hand i'm a bit confuse on how i could CoreData and retrieve all place nearby another whitout actualy fetching many object and doing a distance comparaison InMemory?can you please point me to a solution?
Diallo
CoreData was created to handle data stores as objects so you can even have an XML and use it as a store, You have to use the NSPersistentStoreCoordinator and set the store type to NSSQLiteStoreType. Anyhow I missed the part where you wanted to fetch by radius if that's the case go with SQLite since you cant have aggregate functions in CoreData. And Yes if you go with CoreData you will have to fetch the object into a NSMutableArray and fetch them from there which does not sound like a good idea.
JeremySpouken
Thanks for your help.I think that i should go with SQLite as i want to do some radius search.
Diallo