Given a top-left starting point [ulx, uly], and a cell width 'w' and height 
'h', is it possible to create a table entirely in SQL populated with rows 
increasing from left to right up to X and top to bottom up to Y. The table 
schema would be something like --

CREATE TABLE cells (
  cell_id INTEGER NOT NULL,
  xmid DOUBLE PRECISION,
  ymid DOUBLE PRECISION,
  the_geom GEOMETRY,
  CONSTRAINT cells_pkey PRIMARY KEY (cell_id)
);

where xmid = (xmin + xmax) / 2 and ymid = (ymin + ymax) / 2, [xmin, ymin, xmax, 
ymax] being the corners of each cell.

A bonus question -- is it possible to store two geometry columns in one table? 
For example, if I wanted to store the geometry for both the center points 
[xmin, ymid] as well as the box [xmin, ymin, xmax, ymax], would that be 
possible? Would that even be recommended (for example, to speed up 
queries/drawing, etc.).

Puneet.
_______________________________________________
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users

Reply via email to