Home > front end >  ASP longitude and latitude calculated
ASP longitude and latitude calculated

Time:12-13

There is a calculation of latitude and longitude code:
<%
X1=121.377429
Y1
=31.214794X2=121.5758183
Y2=31.120784

Const EARTH_RADIUS=6378.137
Const Pi=3.1415926535898
The Function rad (d)
Rad=d * Pi/180
End the Function
The Function GetDistance (lat1, lng1, lat2, lng2)
Dim radlat1, radlat2
Dim a, b, s, Temp
Radlat1=rad (lat1)
Radlat2=rad (lat2)
A=radlat1 - radlat2
B=rad (lng1) - rad (lng2)
Temp=Sqr (Sin (a/2) ^ 2 + Cos (radlat1) * Cos (radlat2) * Sin (^ 2)/2 b)
S=2 * Atn (Temp/Sqr (+ 1) - Temp * Temp)
S=s * EARTH_RADIUS

GetDistance=FormatNumber (s, 2)
End the Function
Response. Write GetDistance (x1, y1, x2, y2)
% & gt;
Running alone, but on the circulation do while... The inside of the loop, says the Function rad (d) syntax errors, to solve!

CodePudding user response:

Cycle of the incoming d may not be the correct data types and values,

CodePudding user response:

Post your error code and error message so convenient for others to see
  •  Tags:  
  • ASP
  • Related