11 | | [http://www.bostongis.com/?content_name=postgis_tut01] |
12 | | is the usefull to read next if the following does not work |
13 | | |
14 | | === 1- Install postgres and postgis === |
15 | | (Use stack builder application in postgres command menu) |
16 | | |
17 | | === 2- create database CCM === |
18 | | |
19 | | In PgAdmin, connect to the serveur |
20 | | right clic, create new database, use template postgis to that the database is a geodatabase |
21 | | [[Image(source:EDA/data/Docs/trac/PgAmin_create_gis_database.jpg)]] |
22 | | |
23 | | === 3- Figure out SRID of the data === |
24 | | We'll need to match this descriptive projection to an SRID (the id field of a spatial ref record in the spatial_ref_sys table) if we ever want to reproject our data. |
25 | | Open up your pgadmin III query tool and type in the following statement, use the green arrow to launch the command |
26 | | {{{ |
27 | | select srid, srtext, proj4text from spatial_ref_sys where srtext ILIKE '%ETRS89%'; |
28 | | }}} |
29 | | Now we have to find the good line, it seems to be srid='3035' since it refers to the Eu system and equal area |
30 | | === 4- Create sql database === |
31 | | Open a command batch > execute> cmd |
32 | | Change directory to get to the working directory where the shapes are stored |
33 | | example : |
34 | | {{{ |
35 | | cd C:\Documents and Settings\cedric\Mes documents\Migrateur\eda\w2000a18 |
36 | | }}} |
37 | | The program shp2pqsql installed along postgris allows to transform from shape to .sql |
38 | | type in |
39 | | {{{ |
40 | | C:\program files\postgres\8.4\bin\shp2pgsql -s 3035 COAST coast > coast.sql |
41 | | }}} |
42 | | The file will be created at ''C:\program files\postgres\8.4\bin\shp2pgsql'' |
43 | | to create the coast.sql file from the COAST shape file |
44 | | warning these files are very big and won't open in pgAdmin, use the command batch to lauch the sql file |
45 | | {{{ |
46 | | C:\program files\postgres\8.4\bin\psql -d CCM -h localhost -U postgres -f catchment_w.sql |
47 | | }}} |
48 | | where: -d database -h host -U user -f the sql file. |
49 | | Check at the end of the process if the database is created |
50 | | |