mardi 19 janvier 2010

PostgreSQL-postgis Installation avec QGIS et Pgadmin3

1-Utilisation de finger pour plus d'informations sur les utilisateurs.
finger postgres
-Création d'utilisateur postgres:
$ sudo -s -u postgres 
Password: 
Aprés: 
$sudo -s 
entrez la mot de passe root
aprés
$ su postgres 
$psql
Pour avoir l'interface interactive de PostgreSQL.
création de user et de rôle:
$ createuser -P 
ainsi, le programme vous demanderas naturellement 2 fois votre mot pass.
création de la base: 
$ createdb -O  -E UTF8  
Ajouter la mot de passe: 
 
psql -d postgres -c "ALTER USER postgres WITH PASSWORD 'mot_de_passe';"
 
Reboot PostgreSQL
$ sudo /etc/init.d/postgresql-8.4 restart
Ensuite, on peut se connecter via :
$ psql -U 
Mot de passe pour l'utilisateur  : 
 
Par raisons de securité dans postgreSQL il faut impirativement ajouter des rôles utilisateur ( NOSUPERUSER) et (LOGIN)
Recap:

  
Lancez PgAdmin3:
remplissez les champs concernées: 
Login, Mot de passe,base, nom de la connection, param de securité,Hôte et base de maintenace (template1).
6 details.
 
Pour QGIS il faut installer des tables géometriques tous dabord pour pouvoir se connecter à la base correctement.
Le mieux c'est de créer un database avec le template mentionnées si dessus.
Aprés il reste que d'injecter des shp dans le postgis databse .




 
 
 
 
 
 
 
 
 

 Qgis:
 
1-Importer des shapes dans PostgreSQL.
2-Attention au codage de caractéres (pb).
3-Ajouter une couche postgis.
NB:il faut confirmer la connection à la base à chaque fois. 
 

Enjoy, you can edit on WYSIWYG mode the postgis database also.
 
Manual Data Loading with 
$   shp2pgsql -I -s 32633 POI.shp gis_schema.poi > poi.sql
Shapefile type: Point
Postgis type: POINT[2]
$   shp2pgsql -I -s 32633 vestizioni.shp gis_schema.vestizioni > vestizioni.sql
Shapefile type: Arc
Postgis type: MULTILINESTRING[2]
$  shp2pgsql -I -s 32633 compfun.shp gis_schema.compfun > compfun.sql
Shapefile type: Polygon
Postgis type: MULTIPOLYGON[2]
$  shp2pgsql -I -s 32633 zone.shp gis_schema.zone > zone.sql
Shapefile type: Polygon
Postgis type: MULTIPOLYGON[2] 
 
Note that we used 2 options of the shp2pgsql:

-I will also create a GiST index on the geometry column

-s will give to PostGIS the information of the srid of the data
(srid=32633 is for gis data with a spatial reference WGS84, UTM 33 N) 
Now it is time to execute the *.sql scripts with the gis user:
$ psql -d gisdb -h localhost -U gis -f poi.sql 
 
BEGIN
psql:poi.sql:4: NOTICE:  CREATE TABLE will create implicit sequence "poi_gid_seq" for serial column "poi.gid"
psql:poi.sql:4: NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "poi_pkey" for table "poi"
CREATE TABLE
                  addgeometrycolumn                   
------------------------------------------------------
 gis_schema.poi.the_geom SRID:32633 TYPE:POINT DIMS:2
 
(1 row)
 
CREATE INDEX
COMMIT
Do the same with the other 3 sqls generated from the previous step:
$ psql -d gisdb -h localhost -U gis -f compfun.sql 
$ psql -d gisdb -h localhost -U gis -f vestizioni.sql 
$ psql -d gisdb -h localhost -U gis -f zone.sql

1 commentaire:

GéomatiLux a dit…

ça doit marcher Ismael, reste de tester Qgis et completer la doc.

Talend Certified

Certification is awarded to individuals who successfully complete a comprehensive online test covering all aspects of the use of Talend Open Studio in real-life situations. Clients trusting a systems integrator to implement a solution want to be reassured that the consultants are indeed experts in the technology. Talend certification gives them this level of assurance.

Qui êtes-vous ?

Paris, Île de France, France
I'm a textbook computer geek, who has a keen interest in programming, GIS and mapping.

Linux News

Wikipedia

Mission Topographique

Mission Topographique
Promo6 Mastére Géomatique

Talend Blog

Liste de partage de geomatiLux

Libellés

Media préferé

  • www.talend.com

Le Groupe CLLFST

Le Groupe CLLFST
SFD 2007

CLLFST & INFO+

CLLFST & INFO+
SFD 2007