GIS and Media fusion

"The explosive growth of the GeoWeb and geographic information has made GIS powerful media for the general public to communicate, but perhaps more importantly, GIS have also become media for constructive dialogs and interactions about social issues." - Sui & Goodchild

User Tools

Site Tools


geoinf18:gql1st

This is an old revision of the document!


Spatial database :: PostGIS

Voyons comment utiliser l'extension PostGIS de PostgreSQL pour stocker et gérer de l'information géographique dans un SGBD.

Une première "geotable"

  • Créer une géotable
CREATE TABLE my4capitals (id serial PRIMARY KEY, name text);
SELECT AddGeometryColumn( 'my4capitals', 'the_geom', 4326, 'POINT', 2 );
INSERT INTO my4capitals VALUES ( nextval('my4capitals_id_seq'), 'Paris', ST_GeometryFromText( 'POINT(2.333 48.867)', 4326)); 
INSERT INTO my4capitals VALUES ( nextval('my4capitals_id_seq'), 'Bern', ST_GeometryFromText( 'POINT(7.433 46.95)', 4326));
INSERT INTO my4capitals VALUES ( nextval('my4capitals_id_seq'), 'Rome', ST_GeometryFromText( 'POINT(12.5 41.883)', 4326));
INSERT INTO my4capitals VALUES ( nextval('my4capitals_id_seq'), 'Madrid', ST_GeometryFromText( 'POINT(-3.71 40.41)', 4326));
  • Lire la table et ses données géographiques
SELECT ST_AsEWKT(the_geom) FROM my4capitals;
SELECT ST_AsText(the_geom) FROM my4capitals;
SELECT ST_AsGeoJSON(the_geom) FROM my4capitals;
  • Transformer des coordonnées d'une projection à une autre
SELECT ST_AsEWKT(ST_Transform(the_geom, 21781)), ST_AsEWKT(the_geom) FROM my4capitals;
geoinf18/gql1st.1540916994.txt.gz · Last modified: 2018/10/30 17:29 by oertz