Interesction of haversine formula and latitude/longitude in PHP

To over simplify (good for this project), we need to find how much time it takes for a plane to fly from point A to point B, taking into account the different wind speeds in the path. We can do most of it, but we struggle with one specific part of it, which is explained under 'TASK Description'.

Data available:

*Starting coordinates of the plane

*End coordinates of the plane

*Wind speeds are given by coordinates with 0.25 decimal degree accuracy - this is a bit more explained right below.

Wind speeds for certain locations are given with accuracy of 0.25 decimal degrees. Valid examples are (numbers are in decimal degrees. first is latitude, second is longitude, third is speed):

'59.50, 16.50, 15m/s'

'59.75, 16.50, 13m/s'

'59.75, 16.75, 17m/s'

'60.00, 17.00, 12m/s'

And so on.

Imagine the wind speeds to be in the form of 'box. Taking from the examples above, first 'box' would be calculated in the following way (assuming we are on the north-east side):

\$boxDelta = 0.25/2

\$leftTopPoint = array('lat' => 59.50 - \$boxDelta, 'lng' => 16.50 + \$boxDelta)

\$rightTopPoint = array('lat' => 59.50 + \$boxDelta, 'lng' => 16.50 + \$boxDelta)

\$leftBottomPoint = array('lat' => 59.50 - \$boxDelta, 'lng' => 16.50 - \$boxDelta)

\$rightBottomPoint = array('lat' => 59.50 + \$boxDelta, 'lng' => 16.50 - \$boxDelta)

Top line of the 'box' would be a line between \$leftTopPoint and \$rightTopPoint, right side between \$rightTopPoint and \$rightBottomPoint etc...

So each box contains a certain wind speed, for the 'box' example above it would be 15m/s for the whole box.

Sample assignment the function should be able to solve:

Now we have the box. Lets start from coordinate latitude 59.47, longitude 16.1 and move to latitude 59.58, longitude 17.00. At which coordinates does our flight path intersect with the example 'box' from above?

We need two sets of coordinates, one going in the box and the other going out the box (to simplify for the purpose of this task we will not take into account the box we started from). After that we can get a new box and and do this process again and again and again until we reach destination.

Overly simplified function should look something like this:

function boxInteresectCoordinates(\$startLat, \$startLong, \$endLat, \$endLong, \$leftTopPoint, \$rightTopPoint, \$leftBottomPoint, \$rightBottomPoint, \$altitude) {

// Do magic

return array(\$inBoxLat, \$inBoxLong, \$outBoxLat, \$outBoxLong, \$distanceTraveledInsideBoxInKM);

}

As a visual guide, I added an image (heavily out of proportion), where red line represents the flight path, grid represents the longitude/latitude and blue X represent the coordinates we need to find. - Use it only to get a rough overview of the assignment, the image is quite inaccurate in many ways.

Side notes:

*If one can a recommend solution which is better/faster/more accurate - it would be well welcomed.

*Usages of all libraries is allowed, but in the end the code that we will use has to be in PHP.

I think I have explained the task well. In case of questions, please feel free to ask!

Taidot: Matematiikka, PHP

Tietoa työnantajasta:
( 1 arvostelu ) Tallinn, Estonia

Projektin tunnus: #15110798

20 freelanceria on tarjonnut keskimäärin %project_bid_stats_avg_sub_26% %project_currencyDetails_sign_sub_27% tähän työhön

liangjongai

Hi. I have a great skill in php. I can complete your project. My price and period is negotiable. We can discuss details via chat. Thanks. Relevant Skills and Experience I have much experience in php. Proposed Milesto Lisää

€133 EUR 3 päivässä
(243 arvostelua)
7.7
€133 EUR 3 päivässä
(372 arvostelua)
7.4
mascotindia123

Hey Friend, Myself having has 10 + years experience of web site development. Expert in Custom programming in php / Mysql / Jquery / Wordpress/ Joomla /OSC/ Magento /OpenCart / Android / Mobile development / iPhon Lisää

€250 EUR 3 päivässä
(240 arvostelua)
7.4
WebExpertsx

We read your requirement about formula and latitude/longitude and we want you to know that we have a good past experience in PHP,wordprss,laravel ,angular.js, javascript, Bootstrap html and css Relevant Skills and Ex Lisää

€55 EUR 3 päivässä
(18 arvostelua)
6.7
spiretech

Hello, I have gone through the post and yes; I will help you for sure to Interescting of haversine formula and latitude/longitude in PHP Relevant Skills and Experience [login to view URL], [login to view URL], www. Lisää

€200 EUR 3 päivässä
(91 arvostelua)
6.9
€155 EUR 3 päivässä
(71 arvostelua)
6.6
psubramonian

I've read your requirements in detail and I can able to do the project development with your full satisfaction + projected Delieverables Relevant Skills and Experience PHP+ Web Design Mobile App Development MySQLi Lisää

€200 EUR 3 päivässä
(95 arvostelua)
6.2
dnplugins

Greetings, I am Dominick. I have worked as a website developer and develops games as a hobby. With my interest in games I have developed skills in trigonometry which I am very confident will help me. Relevant Skills a Lisää

€111 EUR 3 päivässä
(47 arvostelua)
5.6
RushService

Feel fee to contact me [login to view URL] me message to discuss further more details .We provide the comments,images,videos,demos and live sessions in order to help the [login to view URL] payment only after the work [login to view URL] yo Lisää

€150 EUR 3 päivässä
(26 arvostelua)
5.0
€200 EUR 3 päivässä
(13 arvostelua)
4.8
€155 EUR 3 päivässä
(5 arvostelua)
4.7
appleearth039

Hello, Client! Thanks for the opportunity to bid on your project. I'm a master in GIS fields. Please have confidence in my skill and quality of work. Thank you!

€111 EUR 3 päivässä
(13 arvostelua)
4.6
elegentcoder

To achieve goal with 100% quality we have team of 15 Professional Software Engg/Developer. Relevant Skills and Experience Our mission to stand out doesn’t stop with our internal goals. Proposed Milestones €222 EUR - Lisää

€222 EUR 3 päivässä
(5 arvostelua)
4.3
€155 EUR 3 päivässä
(10 arvostelua)
4.2
kaiyin91

Dear sir, I am expert web developer with 8 years experience. [login to view URL] [login to view URL] [login to view URL] Relevant Skills and Exper Lisää

€277 EUR 3 päivässä
(3 arvostelua)
4.0
mzdesmag

Please give me an opportunity to work on your project and I will complete it perfectly. I have the required experience for it. Relevant Skills and Experience Mathematics, PHP Proposed Milestones €30 EUR - Initial Mil Lisää

€30 EUR 3 päivässä
(6 arvostelua)
3.4
cjanitha

I am a full-time freelancer with over 15 years of industry experience.

€155 EUR 3 päivässä
(8 arvostelua)
2.4
ankitkumar045

Hello Thanks for opportunity to bid. I would like to submit my candidacy as already developed a lot of website. I have 5 years experience in Development I Lisää

€155 EUR 3 päivässä
(2 arvostelua)
1.9
€155 EUR 3 päivässä
(5 arvostelua)
2.2
ninjanderit

Hi. I have read your description carefully. I can satisfy your requirement at the highest level, in a short time I attach importance to credit rather than money. I think i can cooperate with you well. Relevant Skills Lisää

€55 EUR 3 päivässä
(2 arvostelua)
1.3