Skip to content

Instantly share code, notes, and snippets.

@gannebamm
Created January 5, 2018 13:25
Show Gist options
  • Save gannebamm/0a5f9bd9da8c522ed6ee685c94600a59 to your computer and use it in GitHub Desktop.
Save gannebamm/0a5f9bd9da8c522ed6ee685c94600a59 to your computer and use it in GitHub Desktop.
ST_MakeLine with creating a 3DIM enabled table works for 3d features
CREATE TABLE samplelines
(
id serial,
name character varying(50) COLLATE pg_catalog."default",
CONSTRAINT samplelines_pkey PRIMARY KEY (id)
)
-- add 3dims enabled geometry column
SELECT AddGeometryColumn('public', 'samplelines', 'geom', 25832, 'LINESTRING', 3);
-- pick the samplepoints and create lines
INSERT INTO samplelines (name, geom)
SELECT
's1' AS name,
ST_MAKELINE(
(SELECT geom
FROM samplepoints_xyz
WHERE name = 'al_01'),
(SELECT geom
FROM samplepoints_xyz
WHERE name = 'sound_01')) AS geom
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment