function wof_GetValues($location, $variable, $startDate, $endDate)
 {
     //get the short variable code and short site code
     $split1 = explode(":", $location);
     if (count($split1) > 1) {
         $shortSiteCode = $split1[1];
     } else {
         $shortSiteCode = $split1[0];
     }
     $split2 = explode(":", $variable);
     if (count($split2) > 1) {
         $shortVariableCode = $split2[1];
     } else {
         $shortVariableCode = $split2[0];
     }
     $retVal = '<timeSeriesResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.cuahsi.org/waterML/1.1/">';
     $retVal .= wof_queryInfo_Values($location, $variable, $startDate, $endDate);
     $retVal .= '<timeSeries>';
     //write site information
     $retVal .= db_GetSiteByCode($shortSiteCode, "sourceInfo", "SiteInfoType");
     //write variable information
     $retVal .= db_GetVariableByCode($shortVariableCode);
     //write list of data values
     $retVal .= db_GetValues($shortSiteCode, $shortVariableCode, $startDate, $endDate);
     $retVal .= "</timeSeries>";
     $retVal .= "</timeSeriesResponse>";
     return $retVal;
 }
 function wof_GetValues($location, $variable, $startDate, $endDate)
 {
     //get the short variable code and short site code
     $hasMethodCode = false;
     $methodCode = '';
     $shortSiteCode = $location;
     $shortVariableCode = $variable;
     $pos1 = strpos($location, ":");
     if ($pos1 >= 0) {
         $split1 = explode(":", $location);
         $shortSiteCode = $split1[1];
     }
     $pos2 = strpos($variable, ":");
     if ($pos2 >= 0) {
         $split2 = explode(":", $variable);
         $shortVariableCode = $split2[1];
         //now also check for methodCode
         if (count($split2) > 2) {
             $potentialMethodCode = $split2[2];
             $pos3 = strpos($potentialMethodCode, "=");
             $split3 = explode("=", $potentialMethodCode);
             $methodCode = $split3[1];
             $hasMethodCode = true;
         }
     }
     $retVal = '<timeSeriesResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.cuahsi.org/waterML/1.1/">';
     $retVal .= wof_queryInfo_Values($location, $variable, $startDate, $endDate);
     $retVal .= '<timeSeries>';
     //write site information
     $retVal .= db_GetSiteByCode($shortSiteCode, "sourceInfo", "SiteInfoType");
     //write variable information
     $retVal .= db_GetVariableByCode($shortVariableCode);
     //write list of data values
     if ($hasMethodCode) {
         $methods = db_GetMethodsByCode($methodCode);
     } else {
         $methods = db_GetMethodsByVariable($shortVariableCode);
     }
     $retVal .= db_GetValues($shortSiteCode, $shortVariableCode, $startDate, $endDate, $methods);
     $retVal .= "</timeSeries>";
     $retVal .= "</timeSeriesResponse>";
     return $retVal;
 }
Beispiel #3
0
function wof_GetValues($authToken, $location, $variable, $startDate, $endDate)
{
    //get the short variable code and short site code
    $shortSiteCode = $location;
    $shortVariableCode = $variable;
    $pos1 = strpos($location, ":");
    if ($pos1 >= 0) {
        $split1 = explode(":", $location);
        $shortSiteCode = $split1[1];
    }
    $pos2 = strpos($variable, ":");
    if ($pos2 >= 0) {
        $split2 = explode(":", $variable);
        $shortVariableCode = $split2[1];
    }
    $retVal = '<timeSeriesResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">';
    $retVal .= wof_queryInfo_Values($location, $variable, $startDate, $endDate);
    $retVal .= '<timeSeries>';
    //write site information
    $retVal .= db_GetSiteByCode($shortSiteCode, "sourceInfo", "SiteInfoType");
    //write variable information
    $retVal .= db_GetVariableByCode($shortVariableCode);
    //write list of data values
    $retVal .= db_GetValues($shortSiteCode, $shortVariableCode, $startDate, $endDate);
    $retVal .= "</timeSeries>";
    $retVal .= "</timeSeriesResponse>";
    return $retVal;
}