Thursday, July 27, 2006

PostGIS, PostGres

Instalación
Para este taller veremos la instalación de PostgreSQL+PostGIS en el sistema operativo de las máquinas que tiene cada participante con la siguiente configuración...
http://localhost/phpPgAdmin-4.0.1/
tablas con informacion espacial: geometry_columns, spatial_ref_sys
vista en base de datos: pedazos de varias tablas, como almacenar una consulta

Ejemplo 1

Distancia vertimiento-centroide del municipio

En este ejemplo creamos una linea imaginaria entre el centroide del municipio y cada vertimiento , para determinar aquellos que por definición hayan sido mal ingresados al sistema.

SELECT v.id_vertimiento, v.identif_vertimie, makeline(centroid(m.the_geom), v.the_geom) AS the_geom, length(makeline(centroid(m.the_geom), v.the_geom)) AS long
FROM dp_municipio m
LEFT JOIN ve_vertimiento v ON m.cod_municipio::text = v.cod_municipio::text
WHERE v.id_vertimiento IS NOT NULL;

Formas de espacialzar tablas:
cargar shep: shaepsql ogr2org se agregan a la tabla geometry_columns
funcion postGIS: SELECT AddGeometryColumn (...)
-> las dos formas crean el resgistro en la tabal geometry_colums

sist. de referecia espacial 21892 Cod
Solo cuando se crean vistas

/* correccion en la vista
SELECT v.oid AS gid, v.id_vertimiento, v.identif_vertimie, makeline(centroid(m.the_geom), v.the_geom) AS the_geom, length(makeline(centroid(m.the_geom), v.the_geom)) AS long
FROM dp_municipio m
LEFT JOIN ve_vertimiento v ON m.cod_municipio::text = v.cod_municipio::text
WHERE v.id_vertimiento IS NOT NULL;

/* cuando se creen las tablas, no usar espacion ni mayusculas


almuerzo

continuara....

4326 -> D grados / 21982 -> metros
aquivivo -> EPSG 4326
boundryl -> EPSG

http://ocean.csl.co.uk/ EPSG database

No comments: