0

After the every first start of my application I download all the necessary reference data (text file (csv format) with size of 1MB). This data contains about 30000 lines and each line is a data entry with name, latitude, longitude and height.

Whats the most performant way to save this data? I tried to store the list of these in the IsolatedStorageSettings. But this is absolutely the worst approach.

An other way to go is storing the text file in the IsolatedStorageFile directory and on each launching of the application loading the file and parse them to to my list.

The most inperformant part is reading the file. So I guess using a database like sqlite has the same issue, hasn't it?

How would you treat this issue?

Kind regards, Danny

StayOnTarget
  • 11,743
  • 10
  • 52
  • 81
dannyyy
  • 1,784
  • 2
  • 19
  • 43

1 Answers1

1

I did something similar in WherOnEarth application. We have a SQLCE database that we store the data in and then load the stuff that is near by.

Background reading: http://www.silverlightshow.net/items/Windows-Phone-7.1-Local-SQL-Database.aspx & http://www.jeffblankenburg.com/2011/11/30/31-days-of-mango-day-30-local-database/

I have a sdf file that I ship with the app, a Data class shown below

    [Table]
    public class PointData : IPositionElement, INotifyPropertyChanged
    {
            [Column]
            public string Description { get; set; }

            [Column]
            public double Latitude { get; set; }

            [Column]
            public double Longitude { get; set; }

Then we I read the points that are near by I get them with the following:

    (from ht in _context.Points
         where ht.Latitude >= bottomLeft.Latitude && ht.Latitude <= topRight.Latitude &&
         ht.Longitude >= bottomLeft.Longitude && ht.Longitude <= topRight.Longitude
         select ht
         ).ToArray();

This approach was fast enough for me (i.e. it took less time to get the items out of the sdf file than it did to position them on the screen an ddo all the other associated maths with that. Admitedly I wasnt trying to get 300000 items from the DB. There were more optimizations that I could have done in relation to indexing and things like that, but as I said it was quick enough at the moment so I will revisit it at some point later.

gbanfill
  • 2,216
  • 14
  • 21