Changes between Version 56 and Version 57 of CCM2 download and load


Ignore:
Timestamp:
Apr 4, 2010 9:52:09 PM (15 years ago)
Author:
cedric
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • CCM2 download and load

    v56 v57  
    207207-- In the function I tried to create a wso type to simplify the text. Pb you need to specify  
    208208-- a tablename.columname%TYPE which will have to change along with the column, hence the big ugly script below... 
    209 DROP  FUNCTION IF EXISTS ccm21.pricatch_from_catch(gid_ numeric); 
    210 CREATE OR REPLACE FUNCTION ccm21.pricatch_from_catch(gid_ numeric) RETURNS setof int AS $$ 
     209DROP  FUNCTION IF EXISTS ccm21.mycatchment(gid_ numeric); 
     210CREATE OR REPLACE FUNCTION ccm21.mycatchment(gid_ numeric) RETURNS setof int AS $$ 
    211211        DECLARE 
    212212        result RECORD; 
     
    357357        $$ 
    358358LANGUAGE 'plpgsql' ; 
    359 COMMENT ON FUNCTION ccm21.pricatch_from_catch (gid_ numeric) IS 'Uses the gid from ccm21.riversegments, checks strahler, and select the catchment accordingly, then returns all primary catchments from this larger catchment'; 
     359COMMENT ON FUNCTION ccm21.mycatchment (gid_ numeric) IS 'Uses the gid from ccm21.riversegments, checks strahler, and select the catchment accordingly, then returns all primary catchments from this larger catchment'; 
    360360}}} 
    361361{{{ 
    362362--examples of use 
    363363 
    364 SELECT  ccm21.pricatch_from_catch(234706); --la vilaine dans son ensemble 
     364SELECT  ccm21.mycatchment(234706); --la vilaine dans son ensemble 
    365365-- NOTICE:  result is (6) 
    366366-- NOTICE:  WSO_6 used 
     
    368368-- durée=2s 
    369369-- 
    370 SELECT * from ccm21.catchments where wso1_id in (SELECT  ccm21.pricatch_from_catch(234706)); 
     370SELECT * from ccm21.catchments where wso1_id in (SELECT  ccm21.mycatchment(234706)); 
    371371}}} 
    372372=== Plpgsql function which returns the riversegments upstream from the riversegment selected === 
     
    392392        -- loop 
    393393        for gid_riversegments in select gid from ccm21.riversegments 
    394                 where wso1_id in (SELECT  ccm21.pricatch_from_catch(gid_)) 
     394                where wso1_id in (SELECT  ccm21.mycatchment(gid_)) 
    395395                and CAST( 
    396396                        substring(CAST(round(pfafstette) AS TEXT),1,pfafstette_chain_length) 
     
    403403$$ 
    404404LANGUAGE 'plpgsql' ; 
    405 COMMENT ON FUNCTION ccm21.upstream_segments(gid_ numeric) IS 'This function uses ccm21.pricatch_from_catch to get all the segments from a catchment and searches all segments with a pfafstetter higher than the segment in the bassin. The pfafstette are trucated to the level of the segment used as input in the function'; 
     405COMMENT ON FUNCTION ccm21.upstream_segments(gid_ numeric) IS 'This function uses ccm21.mycatchment to get all the segments from a catchment and searches all segments with a pfafstetter higher than the segment in the bassin. The pfafstette are trucated to the level of the segment used as input in the function'; 
    406406}}} 
    407407Usage example