不存在这样的 acos 函数

2023-02-16移动开发问题
11

本文介绍了不存在这样的 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 函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

The End

相关推荐

硬件音量按钮更改应用程序音量
Hardware Volume buttons change in app volume(硬件音量按钮更改应用程序音量)...
2024-08-12 移动开发问题
10

Cocos2d - 如何检查不同层中对象之间的交集
Cocos2d - How to check for Intersection between objects in different layers(Cocos2d - 如何检查不同层中对象之间的交集)...
2024-08-12 移动开发问题
8

恢复游戏 cocos2d
Resume game cocos2d(恢复游戏 cocos2d)...
2024-08-12 移动开发问题
6

突出显示朗读文本(在 iPhone 的故事书类型应用程序中)
Highlight Read-Along Text (in a storybook type app for iPhone)(突出显示朗读文本(在 iPhone 的故事书类型应用程序中))...
2024-08-12 移动开发问题
9

Cocos2D + 仅禁用 Retina iPad 图形
Cocos2D + Disabling only Retina iPad Graphics(Cocos2D + 仅禁用 Retina iPad 图形)...
2024-08-12 移动开发问题
10

如何将 32 位 PNG 转换为 RGB565?
How to convert 32 bit PNG to RGB565?(如何将 32 位 PNG 转换为 RGB565?)...
2024-08-12 移动开发问题
21