dastudio / gpshelper Goto Github PK
View Code? Open in Web Editor NEW服务端输入 经纬度返回距离和附近的人 单例
服务端输入 经纬度返回距离和附近的人 单例
double Dlongtitude = Math.abs( 111 * 1000 * Math.cos(Math.abs(Point2Longtitude - Point1Longtitude)));
应该是
double Dlongtitude = 111 * 1000 * Math.abs(Point2Longtitude - Point1Longtitude);
另外,这个距离有点不准,用这个计算距离3213米,高德的算法2854米
`
class LatLng{
Double longitude;
Double latitude;
public LatLng(Double longitude, Double latitude) {
this.longitude = longitude;
this.latitude = latitude;
}
}
public float calculateLineDistance(LatLng var0, LatLng var1) {
if(var0 != null && var1 != null) {
double var2 = 0.01745329251994329D;
double var4 = var0.longitude;
double var6 = var0.latitude;
double var8 = var1.longitude;
double var10 = var1.latitude;
var4 *= 0.01745329251994329D;
var6 *= 0.01745329251994329D;
var8 *= 0.01745329251994329D;
var10 *= 0.01745329251994329D;
double var12 = Math.sin(var4);
double var14 = Math.sin(var6);
double var16 = Math.cos(var4);
double var18 = Math.cos(var6);
double var20 = Math.sin(var8);
double var22 = Math.sin(var10);
double var24 = Math.cos(var8);
double var26 = Math.cos(var10);
double[] var28 = new double[3];
double[] var29 = new double[3];
var28[0] = var18 * var16;
var28[1] = var18 * var12;
var28[2] = var14;
var29[0] = var26 * var24;
var29[1] = var26 * var20;
var29[2] = var22;
double var30 = Math.sqrt((var28[0] - var29[0]) * (var28[0] - var29[0]) + (var28[1] - var29[1]) * (var28[1] - var29[1]) + (var28[2] - var29[2]) * (var28[2] - var29[2]));
return (float)(Math.asin(var30 / 2.0D) * 1.27420015798544E7D);
} else {
throw new IllegalArgumentException("非法坐标值");
}
}
`
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.