Coder Social home page Coder Social logo

gpshelper's People

Stargazers

 avatar

Watchers

 avatar

gpshelper's Issues

经纬度距离算法写错了吧?

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("非法坐标值");
	}
}

`

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.