| 10 | -- insertion données Laura |
| 11 | create schema belge; |
| 12 | alter table stations set schema belge; |
| 13 | alter table mesures_ang set schema belge; |
| 14 | alter table obstacles set schema belge; |
| 15 | alter table anguilles set schema belge; |
| 16 | |
| 17 | |
| 18 | set search_path to belge,public,dbeel; |
| 19 | select * from belge.stations; |
| 20 | select st_srid(the_geom) from belge.stations;--103300 |
| 21 | --103300 est le code ESRI mais ce n'est pas un ESPG qui est 31370 |
| 22 | update belge.stations set the_geom=st_setsrid(the_geom,31370); |
| 23 | update belge.stations set the_geom=st_transform(the_geom,3035);--2484 |
| 24 | alter table belge.stations ADD CONSTRAINT station_pkey PRIMARY KEY (st_id ), |
| 25 | CONSTRAINT enforce_dims_the_geom CHECK (st_ndims(the_geom) = 2), |
| 26 | CONSTRAINT enforce_geotype_the_geom CHECK (geometrytype(the_geom) = 'POINT'::text OR the_geom IS NULL), |
| 27 | CONSTRAINT enforce_srid_the_geom CHECK (st_srid(the_geom) = 27572), |
| 28 | CONSTRAINT geometry_valid_check CHECK (isvalid(the_geom)); |
| 29 | |
| 30 | |
| 31 | --Meuse |
| 32 | INSERT INTO dbeel.establishment (et_establishment_name) VALUES ('SPW'); |
| 33 | INSERT INTO dbeel.data_provider(dp_name, dp_et_id) VALUES ('Laura',7); |
| 34 | |
| 35 | alter table stations rename to operations; |
| 36 | create table stations as select distinct on (site) site, organisme, eau,commune, lambex,lambey, code_precxy, the_geom from operations |
| 37 | where code_typpec= 'PECHEELECTRIQUE'; |
| 38 | alter table stations add constraint c_pk_stations PRIMARY KEY (site); |
| 39 | |
| 40 | DROP TABLE if exists belge.stationdbeel CASCADE; |
| 41 | CREATE TABLE belge.stationdbeel ( |
| 42 | LIKE belge.stations, |
| 43 | CONSTRAINT pk_so_op_id PRIMARY KEY (op_id), |
| 44 | CONSTRAINT fk_so_observation_place_type_id FOREIGN KEY (op_no_observationplacetype) |
| 45 | REFERENCES dbeel_nomenclature.observation_place_type (no_id) |
| 46 | MATCH SIMPLE ON UPDATE CASCADE ON DELETE RESTRICT |
| 47 | ) INHERITS (dbeel.observation_places); |
| 48 | |
| 49 | INSERT INTO belge.stationdbeel |
| 50 | SELECT uuid_generate_v4() AS op_id, |
| 51 | 'SPW' AS op_gis_systemname , |
| 52 | 'STATIONS' AS op_gis_layername, |
| 53 | st.site AS op_gislocation, |
| 54 | site AS op_placename, |
| 55 | 10 AS op_no_observationplacetype, -- Sampling station |
| 56 | NULL AS op_op_id, |
| 57 | the_geom, |
| 58 | site, organisme, eau,commune, lambex,lambey, code_precxy FROM belge.stations st ; -- 563 lines |
| 59 | }}} |