Ciao a tutti,
a chi interessa, condivido uno script sql per creare una tabella 3dpolylines in spatialite NEXTGEN con calcolo automatico. Purtroppo Qgis 3.4.1 non è in grado gestire le polilinee 3d spatialite (Errore di SQLite: causa sconosciuta). Solo importando shp-3d da spatialite funziona. Idem per editing della geom. La tabella fa il calcolo grazie ai triggers e confronta con epsg 4326 e 32632. Son graditi pareri o suggerimenti...saluti!
--sviluppo db per 3D_geo
create table linee3d
(pk integer primary key autoincrement,
name text,
lung_2d_wgs84 double,
lung_3d_wgs84 double,
lung_2d_wgs84utmz32n double,
lung_3d_wgs84utmz32n double,
note text);
select addgeometrycolumn('linee3d','geom',4326,'LINESTRING','XYZ');
create trigger insert_autocalc_lenghts after insert on linee3d
begin update linee3d set
lung_2d_wgs84= st_length(geom),
lung_3d_wgs84= st_3dlength(geom),
lung_2d_wgs84utmz32n= st_length(st_transform(geom,32632)),
lung_3d_wgs84utmz32n= st_3dlength(st_transform(geom,32632))
where rowid=new.rowid; end;
create trigger update_autocalc_lenghts after update of geom on linee3d
begin update linee3d set
lung_2d_wgs84= st_length(geom),
lung_3d_wgs84= st_3dlength(geom),
lung_2d_wgs84utmz32n= st_length(st_transform(geom,32632)),
lung_3d_wgs84utmz32n= st_3dlength(st_transform(geom,32632))
where rowid=new.rowid; end;
--inserimento massivo di shp in db.
--aggiungere o cancellare i paragafi a seconda del numero di SHP-3D da inserire in db. Si da per scontato che gli SHP abbiano un campo testo "name" e EPSG: 4326.
create virtual table "1"
using virtualshape('C:\temp\SHP\1','UTF-8',4326);
insert into linee3d ("name", geom)
select "name", geometry from "1";
delete from virts_geometry_columns where virt_name='1';
drop table "1";
create virtual table "2"
using virtualshape('C:\temp\SHP\2','UTF-8',4326);
insert into linee3d ("name", geom)
select "name", geometry from "2";
delete from virts_geometry_columns where virt_name='2';
drop table "2";