但问题是:我无法使用android在sqlITE中创建函数,有没有人知道使用android从sqlite获取附近位置的更好方法?
解决方法
在我看来,你的问题基本上有两种解决方案.
在javaScript中创建必要的函数,并使用结果更新/查询sqlite.
JavaScript非常适合三角学;正弦,余弦和正切. JavaScript可以非常快速地计算高级数学问题.
示例:计算以下问题的答案
The sum of the squares of the first ten natural numbers is,1^2 + 2^2 +…
+ 10^2 = 385. The square of the sum of the first ten natural numbers is,(1 + 2 + … + >10)^2 = 55^2 = 3025. Hence the difference between the sum of the squares of the first ten >natural numbers and the square of the sum is 3025 – 385 = 2640. Find the difference >between the sum of the squares of the first one hundred natural numbers and the square of >the sum.
function Problem_6() { "use strict"; var i = 1,ns = 0,sqs = 0; do { ns += i; sqs += i * i; i += 1; } while (i <= 100); return ns * ns - sqs; }
答案:25164150
这个例子来自Rolando Garza的El blog de rolandog,基于他自己对javaScript全局数学对象的扩展; Math.js.
参考文献:
Mozilla’s JavaScript References for the Global Math Object:
Trigonometry—sine,cosine and tangent with JavaScript,by JJ Gifford.
GeoNames是一个开源数据库,涵盖了世界上大多数国家,城市和村庄的地理信息,包括纬度和经度以及到其他地理位置的距离.
GeoNames既可以通过JSON API作为Web服务,也可以作为可下载的表使用.
2.1 Query GeoNames through JSON API
示例:查找给定纬度/经度的最近交点
http://api.geonames.org/findNearestIntersectionOSMJSON?lat=37.451\u0026amp;lng=-122.18\u0026amp;username=demo
{“intersection”:{“street2”:“柯蒂斯街”,“street1”:“Roble Avenue”,“距离”:“0.08”,“highway2”:“住宅”,“highway1”:“住宅”,“lng” “:” – 122.1808166\”,“LAT”: “37.4506308”}}
在sqlite中本地存储所需的地理信息.