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 to share