This is a migrated thread and some comments may be shown as answers.

Problem calculating distance in query with SQLite plugin

3 Answers 189 Views
Android Devices
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Duncan
Top achievements
Rank 1
Duncan asked on 07 May 2013, 02:25 PM
Hi,

We're using the SQLite plugin and we're trying to calculate the distance between the user and a list of locations set in the database, which all have a longitude and latitude set against them for use in a listview. Normally this wouldn't be a problem however SQLite does not seem to support many math functions such as 'SQRT' etc and in our database query we need to sort the results by distance.

Lots of googling later and I found this blog post which details how to extend SQLite with a custom function: http://www.thismuchiknow.co.uk/?p=71

However I cannot find any documentation on how to extend the SQLite plugin in the same way as discussed in the blog post to get a similar method working. Can anyone give me any pointers on how to overcome this problem?

Many thanks.
Duncan.

3 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 07 May 2013, 03:16 PM
Hello Duncan,

There are two things missing:
  • a JavaScript version of the custom SQL function listed in the blog post.
  • ability to use generic Cordova plug-ins in Icenium, which is something we're working on right now.

So the short answer to your question is - you can't at this time.

Regards,
Steve
the Telerik team

Share feedback and vote for features on our Feedback Portal.
Want some Kendo UI online training - head over to Kendo UI Dojo.
0
Duncan
Top achievements
Rank 1
answered on 07 May 2013, 03:34 PM
Hi,

Thanks for getting back to me so quick, what would you recommend for the best way for me to calculate and sort by distance currently?

Thanks
Duncan.
0
David Silveria
Top achievements
Rank 1
answered on 08 May 2013, 11:36 AM
Consider using javascript to do the calculations, the blog you point to contains the starting point you need: http://www.movable-type.co.uk/scripts/latlong.html
Tags
Android Devices
Asked by
Duncan
Top achievements
Rank 1
Answers by
Steve
Telerik team
Duncan
Top achievements
Rank 1
David Silveria
Top achievements
Rank 1
Share this question
or