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 函数
基础教程推荐
- 可可/目标C(OSX不是iOS)从子对象访问父对象 2022-01-01
- 在 iOS8 中无法获得正确的键盘高度值 2022-01-01
- 如何将多个组件添加到 PickerView? 2022-01-01
- 在 appComponent dagger 2 中动态添加测试模块? 2022-01-01
- 我的 UIImageView 的任务 2022-01-01
- - (CGRect)convertRect:(CGRect)rect toView:(UIView *)view 如何工作 2022-01-01
- Android:STATE_SELECTED不工作 2022-01-01
- 新的@SystemApi 注解是什么意思,和@hide 有什么区别 2022-01-01
- 在 Android 模拟器中激活网络位置提供程序? 2022-01-01
- 突出显示朗读文本(在 iPhone 的故事书类型应用程序中) 2022-01-01
