What modules does the PostgreSQL "earthdistance" module use?

I am assuming the units it uses are meters (m), but that doesn't seem clear from the documentation I've found. Is it correct?

If so, just to check to convert between miles / meters, I suppose these functions should do the trick:

public static function mi2m($mi) {  // miles to meters
    return $mi * 1609.344;
}
public static function m2mi($m) {  // meters to miles
    return $m * 0.000621371192;
}

      

+2


source to share


4 answers


The documentation seems to be unambiguous. For the most part, the module uses default meters. But you can change this to any units that you like, changing one function earth

. Presumably all other functions use this function, so your units can be arbitrary if overstated.

Please note that the operator point <@> point

always runs in miles and this cannot be adjusted.



Your conversion functions are correct, but easy to test:

+6


source


The radius of the Earth is obtained from the earth () function. It is specified in meters



If the Earth's radius is in meters, I'm going to assume your math will be wrong unless you use counters as well.

+1


source


The documentation is clear: paragraph 2 of section F.8.1 says, "The Earth's radius is obtained from the earth () function, given in meters."

+1


source


If you have an entrance in meters, use it like this:

radius_in_metres/1.609

      

-1


source







All Articles