Advertisement
Guest User

Untitled

a guest
Aug 27th, 2016
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.03 KB | None | 0 0
  1. .load mod_spatialite
  2.  
  3. -- Inicializando tablas de metadata
  4. BEGIN;
  5. SELECT initSpatialMetadata();
  6. COMMIT;
  7.  
  8. -- Observar tablas creadas
  9. .tables
  10.  
  11. -- Tabla de poligonos
  12. CREATE TABLE cerco (id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, nombre TEXT NOT NULL);
  13. SELECT addGeometryColumn('cerco', 'area', 4326, 'POLYGON', 2);
  14.  
  15. INSERT INTO cerco (nombre, area) VALUES ('Yanahuara', geomFromText('POLYGON((-71.5452003479004 -16.3805913530897,-71.5515518188477 -16.4014239754096,-71.5437412261963 -16.4057055031012,-71.5346431732178 -16.3815795119829,-71.5452003479004 -16.3805913530897))', 4326));
  16. INSERT INTO cerco (nombre, area) VALUES ('Cercado', geomFromText('POLYGON((-71.5340423583984 -16.3796855363701,-71.5442562103271 -16.4073522194401,-71.5380764007568 -16.410563276217,-71.5188503265381 -16.4052938218392,-71.5185928344727 -16.3815795119829,-71.5340423583984 -16.3796855363701))', 4326));
  17. INSERT INTO cerco (nombre, area) VALUES ('Cayma', geomFromText('POLYGON((-71.5476036071777 -16.3867672639725,-71.5533542633057 -16.3807560465864,-71.5523242950439 -16.3272233406407,-71.5331840515137 -16.3287059823086,-71.5436553955078 -16.3803443125836,-71.5458011627197 -16.3800972717645,-71.5476036071777 -16.3867672639725))', 4326));
  18.  
  19. -- Tabla de lugares
  20. CREATE TABLE lugar (id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, nombre TEXT NOT NULL);
  21. SELECT addGeometryColumn('lugar', 'ubicacion', 4326, 'POINT', 2);
  22.  
  23. INSERT INTO lugar (nombre, ubicacion) VALUES('Fuera', geomFromText('POINT(-71.5285491943359 -16.3652742498081)', 4326));
  24. INSERT INTO lugar (nombre, ubicacion) VALUES('En Cayma 1', geomFromText('POINT(-71.5446853637695 -16.358521166359)', 4326));
  25. INSERT INTO lugar (nombre, ubicacion) VALUES('En Cayma 2', geomFromText('POINT(-71.5464019775391 -16.3690624625856)', 4326));
  26. INSERT INTO lugar (nombre, ubicacion) VALUES('En Yanahuara', geomFromText('POINT(-71.5438270568848 -16.3927782959063)', 4326));
  27. INSERT INTO lugar (nombre, ubicacion) VALUES('En Cercado', geomFromText('POINT(-71.5244293212891 -16.392448929097)', 4326));
  28.  
  29. -- Obtener los lugares dentro de Cayma
  30. -- SELECT ...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement