Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
-- Creo tabella
CREATE TABLE "tmp_lineMerge" AS
SELECT ROW_NUMBER() OVER(ORDER BY pk) AS RowNum,
ST_LineMerge(ST_Union(geom)) AS geom,
tipo,
count(*) as nro,
group_concat (pk) as pk_old -- occhio!!!
FROM "linee"
GROUP BY tipo
order by 3;
-- Ricovero la geometria
SELECT RecoverGeometryColumn('tmp_lineMerge','geom',3004,'Linestring','XY');
-- Dump geometria
SELECT ElementaryGeometries( 'tmp_lineMerge' ,
'geom' , 'lines_merge_tipo' ,'out_pk' , 'out_multi_id', 1 ) as num, 'lines' as label;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment