Take the tour ×  Just a short question to lighten up my
understanding of some PostGIS-code:  Regarding the creation of
user-defined grids I often find the expressions CEILING and
FLOOR. Like in this non-representative example:  SELECT
floor(st_xmax(the_polygon)/1500) FROM ...  What are they exactly
designated for?  Thanks in advance for lightening me up!
share|improve this question add comment  1 Answer  up vote 10
down vote accepted  Floor and ceiling are classical computer and
math functions that basically round numbers down or up.  select
x, floor(x), ceil(x), trunc(x) from (select unnest(ARRAY[-4.8,
-4.2, 4.2, 4.8]) as x) as f;    x   | floor | ceil | trunc  -4.8
|    -5 |   -4 |    -4  -4.2 |    -5 |   -4 |    -4   4.2 |
4 |    5 |     4   4.8 |     4 |    5 |     4 (4 rows)  In the
context of building a grid, it can be used to define the extents
of the grid to aesthetically-pleasing numbers. For example, if
the x- extents of a layer go between Eastings 2754324.254 and
2770756.610, they can be "rou