I want to find Latitude, for example
Point A = (18.5204303,73.8567437)
Point B = (x,73.8567437)
Distance =20KM(Kilometers)
I need to find the latitude(x) of Point B, that is 20 KM from point A.Longitude should be same. Help me Thanks in advance
i found answer for my question
var lat1 = 18.5204303;
var lon1 = 73.8567437;
var d = 20; //Distance travelled
var R = 6371;
var brng = 0;
var LatMax;
brng = toRad(brng);
var lat1 = toRad(lat1), lon1 = toRad(lon1);
var lat2 = Math.asin( Math.sin(lat1)*Math.cos(d/R) +
Math.cos(lat1)*Math.sin(d/R)*Math.cos(brng) );
var lon2 = lon1 + Math.atan2(Math.sin(brng)*Math.sin(d/R)*Math.cos(lat1),
Math.cos(d/R)-Math.sin(lat1)*Math.sin(lat2));
lon2 = (lon2+3*Math.PI) % (2*Math.PI) - Math.PI;
lat2= toDeg(lat2);
lon2= toDeg(lon2);
alert(lat2);
alert(lon2);
function toRad(Value) {
/** Converts numeric degrees to radians */
return Value * Math.PI / 180;
}
function toDeg(Value) {
return Value * 180 / Math.PI;
}
Thank you all
I'm not sure if this should be an answer or a comment. But since I can't write comments yet I'll write an answer.
This page is a great source for doing distance calculations. In this case you are probably looking for code to calculate the new position when traveling along a rhumb line from a given position. Quote from linked page:
To find the lat/lon of a point on true course tc, distance d from (lat1,lon1) along a rhumbline (initial point cannot be a pole!):
lat= lat1+d*cos(tc)
IF (abs(lat) > pi/2) "d too large. You can't go this far along this rhumb line!"
IF (abs(lat-lat1) < sqrt(TOL))
{
q=cos(lat1)
}
ELSE
{
dphi=log(tan(lat/2+pi/4)/tan(lat1/2+pi/4))
q= (lat-lat1)/dphi
}
dlon=-d*sin(tc)/q
lon=mod(lon1+dlon+pi,2*pi)-pi
The link is still useful but you will have to use some algebra to solve for a known longitude and unknown course. Since you are quite far north great circle distances may be more useful than rhumb lines. But I guess that depends on the problem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With