[postgis-users] Efficient 4D range query

Sandro Santilli strk at keybit.net
Wed May 20 02:02:50 PDT 2015


On Wed, May 20, 2015 at 02:18:55AM +0300, Hermano ... wrote:
> Hello
> How one can express a 4D range query in Postgis? I would like to know what 4d points lie within a hypercube. This is my table:    CREATE TABLE myTable
>     (
>       point geometry,
>       attrib double precision,
>       CONSTRAINT ge_idx PRIMARY KEY (point)
>     );
> This is how I inserted the data points:    insert into myTable (point) values (ST_MakePoint(-71.10, 42.31, 12.43, 54.3));
> 
> It's trivial to specify a 2D bounding box, but I couldn't find a way to do the same in 4D. 		 	   		  

The simplest way to specify ranges in N-D is to write them as linestrings:

 ST_MakeLine(
  ST_MakePoint(xmin,ymin,zmin,mmin),
  ST_MakePoint(xmax,ymax,zmax,mmax)
 )

--strk;

  ()   Free GIS & Flash consultant/developer
  /\   http://strk.keybit.net/services.html


More information about the postgis-users mailing list