Alpha Video Training
Results 1 to 10 of 10

Thread: Distance calculation function

  1. #1
    VAR
    Real Name
    Bill Parker
    Join Date
    Apr 2000
    Location
    Dallas, TX
    Posts
    1,714

    Default Distance calculation function

    Does Alpha have an exposed haversine function for calculating distance between 2 lat/lons? Of course it is easy to do my own in xbasic. I am just suprised I don't find something from Alpha.

    Bill.

  2. #2
    Volunteer Moderator Steve Workings's Avatar
    Real Name
    Steve Workings
    Join Date
    Apr 2000
    Location
    The Dreaded Chair
    Posts
    5,628

    Default Re: Distance calculation function

    Jay Talbott has one.
    -Steve


  3. #3
    VAR
    Real Name
    Bill Parker
    Join Date
    Apr 2000
    Location
    Dallas, TX
    Posts
    1,714

    Default Re: Distance calculation function

    I already built one. Just suprised that I didn't find a built-in one since Alpha obviously uses it (or similar) a lot.

    Bill.

  4. #4
    VAR csda1's Avatar
    Real Name
    Ira J Perlow
    Join Date
    Apr 2000
    Location
    Boston, Massachusetts, USA
    Posts
    3,530

    Default Re: Distance calculation function

    Hi Bill,

    Quote Originally Posted by Bill Parker View Post
    Just suprised that I didn't find a built-in one since Alpha obviously uses it (or similar) a lot.
    Where do you see Alpha using it a lot? They may go out to the web using google maps or similar, but I see nothing built-in that operates locally that incorporates geo distance calculations.
    Regards,

    Ira J. Perlow
    Computer Systems Design


    CSDA A5 Products
    New - Free CSDA DiagInfo - v1.39, 30 Apr 2013
    CSDA Barcode Functions

    CSDA Code Utility
    CSDA Screen Capture



  5. #5
    VAR
    Real Name
    Bill Parker
    Join Date
    Apr 2000
    Location
    Dallas, TX
    Posts
    1,714

    Default Re: Distance calculation function

    Just "assuming" that with the radius and other mapping stuff they have for components that some calculations were being done on the Alpha side. If those features are exclusive to SQL geography fields, then maybe not.

    I am now off to trying to calculate "driving" distance between 2 points. I have found javascript code for Google's API. The challenge is trying to convert to xbasic for running on desktop.

    Bill.

  6. #6
    VAR
    Real Name
    Martin W. Cole
    Join Date
    Apr 2000
    Location
    Terrell, Texas (near Dallas)
    Posts
    5,957

    Default Re: Distance calculation function

    Bill, if you ever get it woprking, I would like to buy a copy of it from you.
    Cole Custom Programming - Terrell, Texas
    972 524 8714
    martin_w_cole@msn.com

    ____________________
    "A young man who is not liberal has no heart, but an old man who is not conservative has no mind." GB Shaw

  7. #7
    VAR
    Real Name
    Bill Parker
    Join Date
    Apr 2000
    Location
    Dallas, TX
    Posts
    1,714

    Default Re: Distance calculation function

    I about have it working. Using an xbasic approach vs. javascript. Wading through Alpha's XML parser at the moment.

    Bill.

  8. #8
    VAR csda1's Avatar
    Real Name
    Ira J Perlow
    Join Date
    Apr 2000
    Location
    Boston, Massachusetts, USA
    Posts
    3,530

    Default Re: Distance calculation function

    Hi Martin, Bill

    Quote Originally Posted by martinwcole View Post
    Bill, if you ever get it woprking, I would like to buy a copy of it from you.
    I have a whole suite of geo-coding rountines (e.g. distance, bearing, queries etc) that I developed for A5 earlier than 2003, and I know I had developed Alpha Four versions as early as 1994. While the basic stuff is actually quite straightforward, after running many tests and simulations through them, there are calculations that can blow up if care is not taken to handle those cases. They don't generally happen within the US latitudes and longitudes I believe, but it's been a while since I visited those calculations and I could be wrong. There are points in the arc functions that go to infinity for some values that cause the problem combined with precision of the numbers.

    Many of my routines were extended using a user supplied zipcode table to get latitude and longitudes. I hadn't extended any to the web though.
    Regards,

    Ira J. Perlow
    Computer Systems Design


    CSDA A5 Products
    New - Free CSDA DiagInfo - v1.39, 30 Apr 2013
    CSDA Barcode Functions

    CSDA Code Utility
    CSDA Screen Capture



  9. #9
    VAR
    Real Name
    Bill Parker
    Join Date
    Apr 2000
    Location
    Dallas, TX
    Posts
    1,714

    Default Re: Distance calculation function

    Ira,

    The geo-coding world can certainly be a rat's nest of different datums, algorithms, precision, etc. My head began to spin.

    My current need is just for USA coordinates and I don't need to go between maps and GPS. I have even found that with different Google APIs that the same lat/lon is identified as being on different sides of a street. Fortunately that fits within my accuracy requirements.

    Bill.

  10. #10
    VAR csda1's Avatar
    Real Name
    Ira J Perlow
    Join Date
    Apr 2000
    Location
    Boston, Massachusetts, USA
    Posts
    3,530

    Default Re: Distance calculation function

    Hi Bill,

    Quote Originally Posted by Bill Parker View Post
    The geo-coding world can certainly be a rat's nest of different datums, algorithms, precision, etc. My head began to spin.
    I know the feeling. And then whether the earth is a sphere or pear-shaped, or the number of degrees of accuracy (0.00001 decimal degrees is about 3 feet on earth).

    But then Google is no panacea either. How many people live a half block down the street according to google? I know I do. I wish they allowed you to mark your house on satellite and street views with a physical address to allow better accuracy. At times, the accuracy of the satellite image to the streets also varies a lot too.
    Regards,

    Ira J. Perlow
    Computer Systems Design


    CSDA A5 Products
    New - Free CSDA DiagInfo - v1.39, 30 Apr 2013
    CSDA Barcode Functions

    CSDA Code Utility
    CSDA Screen Capture



Similar Threads

  1. Function for USPS ACS check digit calculation
    By Nathan Zeiset in forum Code Archive
    Replies: 6
    Last Post: 10-06-2008, 10:01 AM
  2. Would like to search by distance
    By Marilyn Wallace in forum Alpha Five Version 6
    Replies: 2
    Last Post: 10-03-2005, 05:57 PM
  3. Zipcode & distance
    By richarddsmith in forum Alpha Five Version 5
    Replies: 17
    Last Post: 07-13-2003, 10:11 AM
  4. Vertical distance
    By Janet Seber in forum Alpha Five Version 5
    Replies: 2
    Last Post: 02-12-2003, 10:35 AM
  5. Zip Code distance finder
    By John Magno in forum Alpha Five Version 5
    Replies: 1
    Last Post: 11-22-2002, 09:38 AM

Bookmarks

Posting Permissions

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