# Flight Distance

**URL:** <https://forum.phpvms.net/t/flight-distance/2249>\
**Category:** phpVMS Legacy Support (v2/v5)\
**Created:** [March 19, 2010, 1:48am UTC](https://forum.phpvms.net/t/flight-distance/2249 "2010-03-19T01:48:01Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![WA101-ALLAN](https://forum.phpvms.net/user_avatar/forum.phpvms.net/wa101-allan/32/55_2.png) [@WA101-ALLAN](https://forum.phpvms.net/u/WA101-ALLAN)\
**Post date:** [March 19, 2010, 1:48am UTC](https://forum.phpvms.net/t/flight-distance/2249/1 "2010-03-19T01:48:01Z")

</div>

Hello all im am currently have distance calculations all messed up not sure what it is but alot of flights are showing me like 6000 miles when they are like 250 miles. Anything i can do to fix this?

Kind Regards,

Allan

Wings Aviation

[www.wingsonair.net](http://www.wingsonair.net)

[allan@wingsonair.net](mailto:allan@wingsonair.net)

---

<div class="post-metadata">

**Author:** ![simpilot](https://forum.phpvms.net/user_avatar/forum.phpvms.net/simpilot/32/26_2.png) [@simpilot](https://forum.phpvms.net/u/simpilot)\
**Post date:** [March 19, 2010, 3:05am UTC](https://forum.phpvms.net/t/flight-distance/2249/2 "2010-03-19T03:05:58Z")

</div>

Could be a lot of things…

Have you deleted airports from the database that are used in previously filed pireps and current schedules?

Are the cities you are having trouble with have the correct Latitude and Longitude in the database?

---

<div class="post-metadata">

**Author:** ![WA101-ALLAN](https://forum.phpvms.net/user_avatar/forum.phpvms.net/wa101-allan/32/55_2.png) [@WA101-ALLAN](https://forum.phpvms.net/u/WA101-ALLAN)\
**Post date:** [March 19, 2010, 10:47am UTC](https://forum.phpvms.net/t/flight-distance/2249/3 "2010-03-19T10:47:55Z")

</div>

All Airport information is correct in the system, the only airport that is working properly is the one our community designed. Also everything you have said is correct!

Kind Regards,

---

<div class="post-metadata">

**Author:** ![hjhjhgjgjh](https://forum.phpvms.net/user_avatar/forum.phpvms.net/hjhjhgjgjh/32/39_2.png) [@hjhjhgjgjh](https://forum.phpvms.net/u/hjhjhgjgjh)\
**Post date:** [March 19, 2010, 12:06pm UTC](https://forum.phpvms.net/t/flight-distance/2249/4 "2010-03-19T12:06:21Z")

</div>

if you know some php.. this could help you:

$lat1 = ‘48.12’; // replace with lat from dep apt (variable)

$lon1 = ‘16.56’; // replace with lon from dep apt (variable)

$lat2 = ‘48.06’; // replace with lat from arr apt (variable)

$lon2 = ‘17.08’; // replace with lon from arr apt (variable)

$distance = (3958\*3.1415926\*sqrt(($lat2-$lat1)\*($lat2-$lat1) + cos($lat2/57.29578)\*cos($lat1/57.29578)\*($lon2-$lon1)\*($lon2-$lon1))/180);

echo round($distance,2);

echo ’ nm’;

---

<div class="post-metadata">

**Author:** ![simpilot](https://forum.phpvms.net/user_avatar/forum.phpvms.net/simpilot/32/26_2.png) [@simpilot](https://forum.phpvms.net/u/simpilot)\
**Post date:** [March 19, 2010, 12:06pm UTC](https://forum.phpvms.net/t/flight-distance/2249/5 "2010-03-19T12:06:52Z")

</div>

> All Airport information is correct in the system, the only airport that is working properly is the one our community designed. Also everything you have said is correct!
> 
> Kind Regards,

What do you mean by “the airport our community designed”? Is all the flights with odd flight distances to ro from that field?

---

<div class="post-metadata">

**Author:** ![WA101-ALLAN](https://forum.phpvms.net/user_avatar/forum.phpvms.net/wa101-allan/32/55_2.png) [@WA101-ALLAN](https://forum.phpvms.net/u/WA101-ALLAN)\
**Post date:** [March 19, 2010, 2:55pm UTC](https://forum.phpvms.net/t/flight-distance/2249/6 "2010-03-19T14:55:21Z")

</div>

We added a custom airport to the system and all flights for that airport are perfect inbound and outbound flights that is, and as far as PHP im an idiot hehehehe if someone could help with that php part would be great thanks.

Kind Regards

---

<div class="post-metadata">

**Author:** ![WA101-ALLAN](https://forum.phpvms.net/user_avatar/forum.phpvms.net/wa101-allan/32/55_2.png) [@WA101-ALLAN](https://forum.phpvms.net/u/WA101-ALLAN)\
**Post date:** [March 19, 2010, 7:44pm UTC](https://forum.phpvms.net/t/flight-distance/2249/7 "2010-03-19T19:44:17Z")

</div>

Well guys think I got this issue taking care of thanks to the update, Thanks for all the help. All I had to do was re add all the flights, thank GOD I am using CSV hehehehe
