Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Distance between 2 GPS points via sea

Featured Replies

hello,

 

I am hoping for some help with an issue i am having,

 

i am working on a website that requires the distance between two points, i have created a PHP function that does this but mine works it out as a straight line

 

the problem is i need it to 'go around' land to represent the distance a ship would travel to get from point A to point B

 

any help would be appreciated

  • Author

Thank you for your reply,

 

is there a way of doing this automatically? or is it something users will need to trace out manually

Thank you for your reply,

 

is there a way of doing this automatically? or is it something users will need to trace out manually

 

 

There's hundreds of scripts that work out straight line distance, but I've never seen anything that works out the distance taking land into the equation.

 

The calculations needed would be staggering and the entire worlds landscape would need to be factored in for every possible journey. Not an easy task. The only conclusion would be as you said - 'users will need to trace out manually'.

 

If somebody does figure this out for you in this thread I would be very impressed.

If you use GPS coordinates, then as everybody says, you get a straight line.

 

If it was for places on land you might somehow use place names (nearest towns) and then use a sat nav website which uses road miles.

 

For shipping, could you set up four points in the sea north, south, east and west of the UK and then use straight line calcs between them for a start? Set up calcs for 1 to 2, 2 to 3, 3 to 4, 4 to 1 and save, then use code to work out the nearest marker to the start GPS, then the final GPS from the nearest marker, then add all the distances. I won't try to do it.

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.