dcsimg
www.webdeveloper.com
Results 1 to 3 of 3

Thread: Map Co-Ordinates

  1. #1
    Join Date
    Jun 2003
    Location
    Worthing, Sussex, UK
    Posts
    5

    Map Co-Ordinates

    I recently posted a thread asking how i could claculate the distance between two places using map co-ordinates and i recieved this very helpful answer.

    You can use this line (your code will need to calculate $distance_across and $distance_up):
    $distance = sqrt($distance_across*$distance_across + $distance_up*$distance_up);


    my only problem now is how to calculate $distance_across and $distance_up what data do i use and how do i use it.


    Any help would be greatly appreciated


    Thanks

  2. #2
    Join Date
    Nov 2002
    Location
    Dartmoor [Holiday]
    Posts
    2,382
    It depends on the format your map co-ordinates are in. If they are just simple numbers, you can use:

    $distance_across = abs($x1 - $x2);
    $distance_up = abs($y1 - $y2);

    This requires you to have the two co-ordinates as pairs of numbers ($x1, $y1 and $x2, $y2). If your map data is in a different format (e.g. letters) you will need to convert it first.

    Adam

  3. #3
    Join Date
    Jun 2003
    Location
    Worthing, Sussex, UK
    Posts
    5
    Thanks guys you have been really helpful

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles