wiki:CookBook EpA

Version 11 (modified by cedric, 15 years ago) (diff)

--

back to first page ..
back to Recipes for EDA CookBook Eda
This corresponds to ticket #14

Adding the shape files to the database

Creating sql file

CD C:\Documents and Settings\cedric\Mes documents\Migrateur\eda\peche_electrique_bretagne\Cédric_Stations IA ANG\Cédric_Stations IA ANG
C:\"Program Files"\PostgreSQL\8.4\bin\shp2pgsql -s 2154 -W LATIN1 Sta_IA_ANG_Bret_L93_CB ia.iabret > ia.sql

using psql to load the file

C:\"Program Files"\PostgreSQL\8.4\bin\psql -d ccm21_eda -h localhost -U postgres -p 5433 -c "CREATE SCHEMA ia;"
C:\"Program Files"\PostgreSQL\8.4\bin\psql -d ccm21_eda -h localhost -U postgres -p 5433 -f ia.sql 

We have to reproject our data

select SRID (the_geom) FROM ia.iabret--2154
ALTER TABLE ia.iabret DROP CONSTRAINT enforce_srid_the_geom;
UPDATE ia.iabret set the_geom=ST_Transform(the_geom,3035) ;
ALTER TABLE ia.iabret ADD CONSTRAINT enforce_srid_the_geom CHECK (st_srid(the_geom) = 3035);
select SRID (the_geom) FROM ia.iabret;--3035

udating table geometry_columns

Update geometry_columns SET srid=3035 where f_table_name='iabret';

Mêmes choses avec les données pêche électrique IAV

C:\"Program Files"\PostgreSQL\8.4\bin\shp2pgsql -s 2154 -W LATIN1 Stations_IAang_IAV_L93 ia.iaiav > iaiav.sql

using psql to load the file

C:\"Program Files"\PostgreSQL\8.4\bin\psql -d ccm21_eda -h localhost -U postgres -p 5433 -f iaiav.sql 
ALTER TABLE ia.iaiav DROP CONSTRAINT enforce_srid_the_geom;
UPDATE ia.iaiav set the_geom=ST_Transform(the_geom,3035) ;
ALTER TABLE ia.iaiav ADD CONSTRAINT enforce_srid_the_geom CHECK (st_srid(the_geom) = 3035);
Update geometry_columns SET srid=3035 where f_table_name='iaiav';