in reply to Lat/Lon to V&H conversion

Do you really need to convert back again ? If you are converting them from Lat/Long in the first place why not maintain a hash (or tied db if too many for hash) keyed on V&H of each Lat/Long you convert ? This assumes you are not performing any transformations of the resultant V&H only calculating various mileage distances as given above.

The other possibility is to calculate mileage directly from the Lat/Long pairs, this is not too hard (I can't remember the formula now but look up spherical geometry or celestial navigation (as in with a sextant, not for spacecraft :-) You can solve a spherical triangle based on the angle your two points make with one of the poles and the distance between each point and the pole (90-Lat)*CircEarth/360(in your desired units).

# why is there not a <pseudocode> tag :) ? # here is the triangle we solve... # # A (North Pole) # / \ # c b # / \ # B---a---C # # Point A is the north pole, B an C are all yours # $pointB $latB, $longB # $pointC $latC, $longC # here is the formula # cos a = cos b * cos c + sin b * sin c + cos A $miles_per_degree=$Earths_Circumference/360; $Angle_A=abs($longB - $longC); # needs fix for wrapping round the prim +e meridian $Len_b = (90-LongC)*$miles_per_degree; # fix for south of equator $Len_c = (90-LongB)*$miles_per_degree; # make degrees S negative ? # plug those three into the spherical circle equasion

Cheers,
R.

Replies are listed 'Best First'.
Re^2: Lat/Lon to V&H conversion
by jcoxen (Deacon) on Oct 14, 2004 at 13:08 UTC
    Sorry if I gave the wrong idea. I don't need to calculate wire miles, I need to do data verification on several databases - some containing lat/long, some containing V&H, some containing both.

    I need to cross verify that none of the coordinates were fat-fingered when they were entered (lat/long listed matches v&h listed) and play fill in the blanks where one or the other coordinate pair is missing.

    Jack