Changes between Version 15 and Version 16 of import layers postgis


Ignore:
Timestamp:
Jun 23, 2018 8:25:10 PM (7 years ago)
Author:
cedric
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • import layers postgis

    v15 v16  
    9696 
    9797 
     98To be able to explore the topology we could use pfafstetter 
    9899 
     100{{{!#sql 
     101/*----------------------------------------- 
     102Function to get all segments downstream from one one in the same subbasin 
     103Problem when the subbasin changes it is difficult to go downstream 
     104-----------------------------------------*/ 
     105CREATE OR REPLACE FUNCTION downstream_segments(_id text)  
     106RETURNS TABLE(pfafcuen character varying(254), lngtramo_m numeric) AS 
     107$$ 
     108BEGIN 
     109        RAISE NOTICE 'downstream segment for %', _id;    -- prints the selected segment 
     110        RETURN QUERY    
     111             SELECT r.pfafcuen, r.lngtramo_m from  oria_a_rios_v2 r  
     112                WHERE 
     113                 substring(_id::text,1,char_length(_id::text)-1)=  
     114                   substring(r.pfafcuen::text,1,char_length(r.pfafcuen::text)-1)  
     115                AND 
     116                 _id>r.pfafcuen 
     117                AND 
     118                 (r.pfafcuen::numeric % 2) = 1  
     119               order by r.pfafcuen::numeric DESC;  -- even number                
     120END 
     121$$ 
     122  LANGUAGE plpgsql VOLATILE; 
     123select * from downstream_segments('10037146457');  
     124}}} 
    99125 
     126this query returns the three odd nodes dowstream from '10037146457' 
     127 
     128||pfafcuen||    pfafrio|| 
     129||10037146451||100371464|| 
     130||10037146453||100371464|| 
     131||10037146455||100371464|| 
     132Problem from that step we need to go to another number 
     133 
     13410037146451 => 1003714643 
     135 
     136Before trying too much the following problem arises 
     137[[Image(source:eda/data/Docs/trac/sudoang/network_topology.PNG,400px)]]