Problem calculating distance in query with SQLite plugin

4 posts, 0 answers
  1. Duncan
    Duncan avatar
    6 posts
    Member since:
    Feb 2013

    Posted 07 May 2013 Link to this post

    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.
  2. Steve
    Admin
    Steve avatar
    10941 posts

    Posted 07 May 2013 Link to this post

    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.
  3. Duncan
    Duncan avatar
    6 posts
    Member since:
    Feb 2013

    Posted 07 May 2013 Link to this post

    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.
  4. David Silveria
    David Silveria avatar
    234 posts
    Member since:
    May 2006

    Posted 08 May 2013 Link to this post

    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
Back to Top