我正在尝试在PHP/MySQL中使用hasrsine公式将附近的位置移到我所在的位置
我正在使用AJAX在我的谷歌地图上只获取附近的标记.
我所知道的是我的查询没有返回任何内容.
我知道在我看的地方有一个位置.
基本上,使用hasrsine公式我的代码出了什么问题?
编辑 - 从这里改变吨以遵循教程.错误仍然是一样的.
PHP
$lati = 40.78405877579076;
$longi = -73.94800172194275;
class RadiusCheck
{
var $maxLat;
var $minLat;
var $maxLong;
var $minLong;
function RadiusCheck($Latitude, $Longitude, $Miles)
{
global $maxLat,$minLat,$maxLong,$minLong;
$EQUATOR_LAT_MILE = 69.172;
$maxLat = $Latitude + $Miles / $EQUATOR_LAT_MILE;
$minLat = $Latitude - ($maxLat - $Latitude);
$maxLong = $Longitude + $Miles / (cos($minLat * M_PI / 180) * $EQUATOR_LAT_MILE);
$minLong = $Longitude - ($maxLong - $Longitude);
}
function MaxLatitude()
{
return $GLOBALS["maxLat"];
}
function …Run Code Online (Sandbox Code Playgroud) 输入:
要求输出:
从我当前位置提供半径的纬度列表.
有人能给我实现它的方法吗?
我有以下代码来检查传递的位置是否在传递的半径范围内...我们如何优化更多?我不是每次都使用for循环检查我的所有位置
public static boolean pointIsInCircle(PointF pointForCheck, PointF center,
double radius) {
if (getDistanceBetweenTwoPoints(pointForCheck, center) <= radius)
return true;
else
return false;
}
public static double getDistanceBetweenTwoPoints(PointF p1, PointF p2) {
double R = 6371000; // m
double dLat = Math.toRadians(p2.x - p1.x);
double dLon = Math.toRadians(p2.y - p1.y);
double lat1 = Math.toRadians(p1.x);
double lat2 = Math.toRadians(p2.x);
double a = Math.sin(dLat / 2) * Math.sin(dLat / 2) + Math.sin(dLon / 2)
* Math.sin(dLon …Run Code Online (Sandbox Code Playgroud) 我已经有这个问题几天了,我找不到任何关于如何解决它的信息。我从来没有遇到过这样的错误:
myproject.exe 中 0x00511e0e (msvcr100d.dll) 处的未处理异常:0xC0000005:访问冲突写入位置 0xfdfdfdfd。
我真的不知道该怎么办。有什么帮助吗?
我有一个基于位置的社交网络应用程序.但它比其他类似的应用程序加载速度慢很多.加载照片时它确实变慢了.如果我在我的应用程序的聊天窗口中发送照片,然后在其他类似应用程序中发送相同的照片我的应用程序需要10倍的时间.但我不知道为什么
location ×4
android ×1
c++ ×1
cplex ×1
distance ×1
geo ×1
geolocation ×1
google-maps ×1
iphone ×1
java ×1
loading ×1
mysql ×1
performance ×1
php ×1
writing ×1