damini chopra
damini chopra

Reputation: 133

Supporting 3D coordinates in TimescaleDB

Does TimescaleDB support 3D coordinates like latitude, longitude and altitude? In the docs it is said it supports 3D coordinates, but in an example only latitude and longitude is used. Please, help me to clear on this. Also, if its clear written in some document. Thanks

Upvotes: 0

Views: 184

Answers (1)

k_rus
k_rus

Reputation: 3219

Extension PostGIS can be installed alongside with TimescaleDB. PostGIS supports 3D points, which are created by ST_MakePoint. Timescale provides a nice tutorial, which shows how to use TimescaleDB and PostGIS together. The tutorial demonstrates usage of 2D, however you can use 3D points instead.

UPDATE: 3D types are described in PostGIS docs on this page.

Here is an example with using PointZ type:

CREATE EXTENSION timescaledb;
CREATE EXTENSION postgis;

CREATE TABLE t AS (
  time timestamptz not null,
  geom  geometry(pointz)
);
SELECT create_hypertable('t','time');
INSERT INTO t(time, geom) VALUES ('2020-07-21 11:25', ST_MakePoint(2822.6, 33629.8, 41000.0));

Upvotes: 3

Related Questions