Skip to content

Instantly share code, notes, and snippets.

@pigreco
Last active February 2, 2019 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pigreco/64afa98f2aef3aef38047a232234f587 to your computer and use it in GitHub Desktop.
Save pigreco/64afa98f2aef3aef38047a232234f587 to your computer and use it in GitHub Desktop.
-- creo tabella
CREATE TABLE "pti_quadri_elettrici"
(
"pk_uid" integer PRIMARY KEY autoincrement NOT NULL,
"data_ril" date,
"nome_quadro" text,
"path_quadro" text
)
--aggiungo colonna geometry
SELECT AddGeometryColumn ('pti_quadri','geom',3003,'POINT','XY');
-- creo una view
create view "v_nome_quadri" as
select q.pk_uid as rowid, q.nome_quadro, q.geom as the_geom
from "pti_quadri_elettrici" q;
-- registro spatiali_view
INSERT INTO views_geometry_columns
(view_name, view_geometry, view_rowid, f_table_name, f_geometry_column, read_only)
VALUES ('v_nome_quadri', 'the_geom', 'rowid', 'pti_quadri_elettrici', 'geom',1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment