Thread: earthdistance Module & Syntax

earthdistance Module & Syntax

From
"Bee.Lists"
Date:
Hi folks.

I want to get the earthdistance module working on psql 9.6.5.  I’ve installed the module:

rich=# CREATE EXTENSION earthdistance CASCADE;
NOTICE:  installing required extension "cube"
CREATE EXTENSION

And I restarted my box, so the functions are loaded:


 Schema |        Name        | Result data type |           Argument data types            |  Type
--------+--------------------+------------------+------------------------------------------+--------
 public | cube               | cube             | cube, double precision                   | normal
 public | cube               | cube             | cube, double precision, double precision | normal
 public | cube               | cube             | double precision                         | normal
 public | cube               | cube             | double precision, double precision       | normal
 public | cube               | cube             | double precision[]                       | normal
 public | cube               | cube             | double precision[], double precision[]   | normal
 public | cube_cmp           | integer          | cube, cube                               | normal
 public | cube_contained     | boolean          | cube, cube                               | normal
 public | cube_contains      | boolean          | cube, cube                               | normal
 public | cube_coord         | double precision | cube, integer                            | normal
 public | cube_coord_llur    | double precision | cube, integer                            | normal
 public | cube_dim           | integer          | cube                                     | normal
 public | cube_distance      | double precision | cube, cube                               | normal
 public | cube_enlarge       | cube             | cube, double precision, integer          | normal
 public | cube_eq            | boolean          | cube, cube                               | normal
 public | cube_ge            | boolean          | cube, cube                               | normal
 public | cube_gt            | boolean          | cube, cube                               | normal
 public | cube_in            | cube             | cstring                                  | normal
 public | cube_inter         | cube             | cube, cube                               | normal
 public | cube_is_point      | boolean          | cube                                     | normal
 public | cube_le            | boolean          | cube, cube                               | normal
 public | cube_ll_coord      | double precision | cube, integer                            | normal
 public | cube_lt            | boolean          | cube, cube                               | normal
 public | cube_ne            | boolean          | cube, cube                               | normal
 public | cube_out           | cstring          | cube                                     | normal
 public | cube_overlap       | boolean          | cube, cube                               | normal
 public | cube_size          | double precision | cube                                     | normal
 public | cube_subset        | cube             | cube, integer[]                          | normal
 public | cube_union         | cube             | cube, cube                               | normal
 public | cube_ur_coord      | double precision | cube, integer                            | normal
 public | distance_chebyshev | double precision | cube, cube                               | normal
 public | distance_taxicab   | double precision | cube, cube                               | normal
 public | earth              | double precision |                                          | normal
 public | earth_box          | cube             | earth, double precision                  | normal
 public | earth_distance     | double precision | earth, earth                             | normal
 public | g_cube_compress    | internal         | internal                                 | normal
 public | g_cube_consistent  | boolean          | internal, cube, smallint, oid, internal  | normal
 public | g_cube_decompress  | internal         | internal                                 | normal
 public | g_cube_distance    | double precision | internal, cube, smallint, oid, internal  | normal
 public | g_cube_penalty     | internal         | internal, internal, internal             | normal
 public | g_cube_picksplit   | internal         | internal, internal                       | normal
 public | g_cube_same        | internal         | cube, cube, internal                     | normal
 public | g_cube_union       | cube             | internal, internal                       | normal
 public | gc_to_sec          | double precision | double precision                         | normal
 public | geo_distance       | double precision | point, point                             | normal
 public | latitude           | double precision | earth                                    | normal
 public | ll_to_earth        | earth            | double precision, double precision       | normal
 public | longitude          | double precision | earth                                    | normal
 public | sec_to_gc          | double precision | double precision                         | normal


I am using the following SQL as a test in both psql as well as a postgresql client:

SELECT round((point(43.664828,-79.341620) <@> point(44.418390, -80.096013))::numeric,3) as miles

psql isn’t giving any feedback, however the client is telling me this:


ERROR:  operator does not exist: point <@> point
LINE 1: SELECT round((point(43.664828,-79.341620) <@> point(44.41839...
                                                  ^
HINT:  No operator matches the given name and argument type(s). You might need to add explicit type casts.


I’m not sure what to do at this point.  It seems the db isn’t recognizing the distance comparator.

Anybody know what I’m doing wrong?  I appreciate any feedback.



Cheers, Bee