Interesction of haversine formula and latitude/longitude in PHP

Cancelled Posted 6 years ago Paid on delivery
Cancelled Paid on delivery

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.

TASK Description:

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!

Mathematics PHP

Project ID: #15110798

About the project

19 proposals Remote project Active 6 years ago

19 freelancers are bidding on average €153 for this job

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 More

€133 EUR in 3 days
(264 Reviews)
7.8
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 More

€250 EUR in 3 days
(254 Reviews)
7.5
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 More

€55 EUR in 3 days
(20 Reviews)
6.8
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 More

€111 EUR in 3 days
(55 Reviews)
5.9
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 More

€200 EUR in 3 days
(99 Reviews)
6.3
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 in 3 days
(13 Reviews)
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 - More

€222 EUR in 3 days
(5 Reviews)
4.3
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 More

€30 EUR in 3 days
(7 Reviews)
3.5
cjanitha

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

€155 EUR in 3 days
(8 Reviews)
2.4
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 More

€55 EUR in 3 days
(2 Reviews)
1.3