-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathembed.html
More file actions
43 lines (30 loc) · 1.04 KB
/
Copy pathembed.html
File metadata and controls
43 lines (30 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<!DOCTYPE html>
<html>
<body>
<h2>JavaScript Longitude Latitude Estimation Degree to Miles</h2>
<p id="demo"></p>
<script>
var lati = 36;
var lon = -94;
var R = 3959;
var circumference = 2 * Math.PI * R;
var D_lat_1_deg = circumference / 360;
var D_lat_1_deg = D_lat_1_deg.toFixed(2);
var lat = Math.abs(lati);
var radian = (90 - lat) * (2 * Math.PI / 360);
var R_lat = Math.sin(radian) * R;
var circumference_lat = 2 * Math.PI * R_lat;
var D_lon_1_deg = circumference_lat / 360;
var D_lon_1_deg = D_lon_1_deg.toFixed(2);
document.getElementById("demo").innerHTML =
"Convert a degree in coordinates on Earth to miles, at Longitude " +
lon + " degrees and Latitude " + lati + " degrees" +
". <br>One degree Latitude on Earth is: " +
D_lat_1_deg + " miles. <br>" +
"One degree Longitude on Earth, at " +
lat + " degrees Latitude, is: " + D_lon_1_deg + " miles. <br>" +
"Then filter Longitude from " + (lon - 3) + " to " + (lon + 3) + " degrees. <br> And Latitude from " +
(lati - 3) + " to " + (lati + 3) + " degrees.";
</script>
</body>
</html>