wiki:Download and load RHT topology

back to first page..
back to RHT - Download and load RHT
Go to CookBook join RHT-BDMAP

NTF_France_II_degrees / NTF Lambert zone II (srid 27572) --> ETRS1989-LAEA (srid 3035)

Integrating topology (rht_vs2_export_cjouanin_sept11.csv)

drop table  if exists rht.topologie_rht_sept2011;
CREATE TABLE rht.topologie_rht_sept2011
(
  ID_DRAIN integer,
  Xcdg numeric,
  Ycdg numeric,
  Xstart numeric,
  Ystart numeric,
  Lg numeric,
  Gridid integer,
  Fnode integer,
  Tnode integer,
  Long numeric
);

copy rht.topologie_rht_sept2011 from 'D:/CelineJouanin/RHT_Estimkart/rht_vs2_export_cjouanin_sept11.csv' with csv delimiter as ';' header; 
alter table rht.topologie_rht_sept2011 add constraint  pk_id_drain_topo primary key (id_drain);
set client_encoding to 'latin1';

id_drain 30000 sans topologie
Create a view rht_topology

Alter table rht.topologie_rht_sept2011 rename column Length to length;
ALTER TABLE rht.topologie_rht_sept2011 RENAME COLUMN id_drain TO id_draintopo;

Integrating "noeuds"

--Celine
d:
cd D:\CelineJouanin\RHT_Estimkart
C:\"Program Files"\PostgreSQL\8.4\bin\shp2pgsql -s 27572 -c -g the_geom -W LATIN1 -I noeud_rhtot_3035.shp rht_noeud > rht_noeud.sql 
(I can't convert this version into utf8 with notepad)
C:\"Program Files"\PostgreSQL\8.4\bin\psql -d eda2.0_RHT -h localhost -U postgres -p 5432 -f rht_noeud.sql 

alter table rht_noeud set schema rht;

CREATE INDEX indexnoeud
ON rht.rht_noeud
USING btree (node_id);

Topology de l'amont vers l'aval.

Problems

One id_drain without topology : id_drain=30000
Some problem with the downstream node see D:\CelineJouanin\RHT_Estimkart\RHT problems --> en cours de résolution

d:
cd D:\CelineJouanin\EDA20RHT
C:\"Program Files"\PostgreSQL\8.4\bin\shp2pgsql -s 3035 -c -g the_geom -W LATIN1 -I noeudmer_polygon.shp noeudmer_polygon > noeudmer_polygon.sql 
C:\"Program Files"\PostgreSQL\8.4\bin\psql -d eda2.0_RHT -h localhost -U postgres -p 5432 -f noeudmer_polygon.sql 

alter table rht.noeudmer add column noeudmer boolean;
update rht.noeudmer SET noeudmer='t' where noeudmer is null
update rht.noeudmer SET noeudmer='f' where id_drain in (select id_drain from rht.noeudmer n join rht.noeudmer_polygon p on st_contains(p.the_geom,n.the_geom) OR id_drain in ('215366','215406','215988','226746'));

create table rht.fromnodetonode as (select taval.id_drain as id_drainaval, tamont.id_drain as id_drainamont from rht.rht_topology tamont join rht.rht_topology taval on tamont.tnode=taval.fnode);
alter table rht.rht_topology add column nextdownid integer;
update rht.rht_topology SET nextdownid=id_drainaval from rht.fromnodetonode ft where id_drain=ft.id_drainamont;


-- correction d'un problème par Cédric
select  * from rht.rht_topology where id_drain=nextdownid
update rht.rht_topology set nextdownid=-9999 where id_drain=nextdownid --505

Problèmes projections résolus :

update rht.rht_topology set the_geom=rht.the_geom from rht.rht
 where rht.id_drain=rht_topology.id_drain; 
Last modified 7 years ago Last modified on Jun 1, 2018 5:57:03 PM