3.9.  Coordinates range #

A spherical box is a coordinates range. Hence, you can select objects within a longitude range and latitude range. The box is represented using two spherical points: the southwest (pos_sw) and the northeast (pos_ne) edge of the box. The input syntax is:

( pos_sw, pos_ne )

or

pos_sw, pos_ne

Note

  • If the latitude of the southwest edge is larger than the latitude of the northeast edge, pgSphere swaps the edges.

  • If the longitude of the southwest edge is equal to the longitude of the northeast edge, pgSphere assumes a full latitude range, except that the latitudes are equal, too.

Example 3.12.  Input of a full latitude range

A full latitude range between +20° and +23°.

sql> SELECT sbox '( (0d,20d), (0d,23d) )';
              

Example 3.13. A simple coordinates range

A coordinate range between -10° and +10° in latitude and 350° and 10° in longitude.

sql> SELECT sbox '( (350d,-10d), (10d,+10d) )';