I have the Lat/Lng of locations in an SQLite table. I also generated the SQLite DataContext class through SQLMetal.
I need SQLite to SORT BY whichever location is closer to a given Lat/Long coordinate. I'm using LINQ, and it doesn't seem to support ExecuteQuery* or whatever the WP7 equivalent could be.
Is it possible to run calculations via LINQ?
I've found this equation that should calculate the distance quickly. I simply have no idea how to use this in my existing DataContext.
I need SQLite to SORT BY whichever location is closer to a given Lat/Long coordinate. I'm using LINQ, and it doesn't seem to support ExecuteQuery* or whatever the WP7 equivalent could be.
Is it possible to run calculations via LINQ?
I've found this equation that should calculate the distance quickly. I simply have no idea how to use this in my existing DataContext.
Code:
((<lat> - LATITUDE_COLUMN) * (<lat> - LATITUDE_COLUMN) +
(<lng> - LONGITUDE_COLUM) * (<lng> - LONGITUDE_COLUM))