No such acos function exists(不存在这样的 acos 函数)
问题描述
我有问题.我想在 android 应用程序中获取谷歌地图上最近的点.不同的点/坐标存储在 sqlite 数据库中.我必须从他们那里得到最近的 5 个.我正在使用的查询是:
I've a problem. I want to get the nearest points on google map in android app. Different points/coordinates are stored in sqlite database. And I have to get the nearest 5 from them. The Query I'm using is:
SELECT id, ( 3959 * acos( cos( radians(37) ) * cos( radians( lat ) ) * cos( radians( lng ) - radians(-122) ) + sin( radians(37) ) * sin( radians( lat ) ) ) ) AS distance FROM markers HAVING distance < 25 ORDER BY distance LIMIT 0 , 5;
但我收到一个错误,即没有这样的功能:acos 存在".它的正确解决方案是什么
But I'm getting an error i.e. "no such function: acos exists". What will be its proper solution
推荐答案
SQLite 默认不支持任何三角函数,所以你不能在 SQL 查询中使用它们.
SQLite doesn't support any trigonometric functions by default, so you can't use them in SQL queries.
您可以获取坐标列表并在应用程序代码中处理它,或者您可以尝试使用用户定义的函数在 SQLite 中公开 Java 的三角函数(请参阅 如何在 SQLite 中创建用户定义函数?).
You can either fetch the list of coordinates and process it in application code, or you can try and expose Java's trigonometric functions in SQLite with user defined functions (see How can I create a user-defined function in SQLite?).
这篇关于不存在这样的 acos 函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:不存在这样的 acos 函数
基础教程推荐
- iPhone - 获取给定地点/时区的当前日期和时间并将其与同一地点的另一个日期/时间进行比较的正确方法 2022-01-01
- 通过重定向链接在 Google Play 中打开应用 2022-01-01
- libGDX 从精灵或纹理中获取像素颜色 2022-01-01
- 如何从 logcat 中删除旧数据? 2022-01-01
- NSString intValue 不能用于检索电话号码 2022-01-01
- navigator.geolocation.getCurrentPosition 在 Android 浏览器上 2022-01-01
- iOS4 创建后台定时器 2022-01-01
- Android:getLastKnownLocation(LocationManager.NETWORK_PROVIDER 2022-01-01
- Cocos2d iPhone 非矩形精灵触摸检测 2022-01-01
- AdMob 广告未在模拟器中显示 2022-01-01
