@ -39,25 +39,22 @@ bounding box usable for index searches.
The functions are all 'sql' functions. If you want to make these functions
The functions are all 'sql' functions. If you want to make these functions
executable by other people you will also have to make the referenced
executable by other people you will also have to make the referenced
cube functions executable. cube(text), cube_distance(cube,cube),
cube functions executable. cube(text), cube(float8), cube(cube,float8),
cube_ll_coord(cube,int) and cube_enlarge(cube,float8,int) are used indirectly
cube_distance(cube,cube), cube_ll_coord(cube,int) and
by the earth distance functions. is_point(cube) and cube_dim(cube) are used
cube_enlarge(cube,float8,int) are used indirectly by the earth distance
in suggested constraints for data in domain earth. cube_ur_coord(cube,int)
functions. is_point(cube) and cube_dim(cube) are used in constraints for data
is used in the regression tests and might be useful for looking at bounding
in domain earth. cube_ur_coord(cube,int) is used in the regression tests and
box coordinates in user applications.
might be useful for looking at bounding box coordinates in user applications.
A domain of type cube named earth is defined. Since check constraints
A domain of type cube named earth is defined.
are not supported for domains yet, this isn't as useful as it might be.
There are constraints on it defined to make sure the cube is a point,
However the checks that should be supplied to all data of type earth are:
that it does not have more than 3 dimensions and that it is very near
the surface of a sphere centered about the origin with the radius of
constraint not_point check(is_point(earth))
the Earth.
constraint not_3d check(cube_dim(earth) <= 3)
constraint on_surface check(abs(cube_distance(earth, '(0)'::cube) /
earth() - 1) < '10e-12'::float8);
The following functions are provided:
The following functions are provided:
earth() - Returns the radius of the e arth in meters.
earth() - Returns the radius of the E arth in meters.
sec_to_gc(float8) - Converts the normal straight line (secant) distance between
sec_to_gc(float8) - Converts the normal straight line (secant) distance between
between two points on the surface of the Earth to the great circle distance
between two points on the surface of the Earth to the great circle distance
@ -118,7 +115,7 @@ Subject: [QUESTIONS] Re: Spatial data, R-Trees
> look at to create these?
> look at to create these?
Here's the setup for adding an operator '<@>' to give distance in
Here's the setup for adding an operator '<@>' to give distance in
statute miles between two points on the e arth's surface. Coordinates
statute miles between two points on the E arth's surface. Coordinates
are in degrees. Points are taken as (longitude, latitude) and not vice
are in degrees. Points are taken as (longitude, latitude) and not vice
versa as longitude is closer to the intuitive idea of x-axis and
versa as longitude is closer to the intuitive idea of x-axis and
latitude to y-axis.
latitude to y-axis.