Reputation: 597
I have to store logical 3d coordiantes of object in postgres database. Each object typicaly has from 50-1000 points and probably never exceed 10000. My intension is to use column of type real [][] in postgres.
I looked also postGis extension and wonder if it is suitable solution, but could not answer myself of several questions:
Upvotes: 1
Views: 1501
Reputation: 247585
It would be natural to use the PostGIS geometry(pointz)[]
as data type, an array of three-dimensional points.
Here is an example that shows a constant of that type and calculates the distance between the points:
WITH x(p) AS (
SELECT '{POINT Z (1 2 3):POINT Z (3 0 2)}'::geometry(pointz)[]
)
SELECT st_3ddistance(p[1], p[2]) FROM x;
st_3ddistance
---------------
3
(1 row)
Upvotes: 2