MD 833 weather conditions
MD 833 Monday Night 2024-12-30 weather conditions
- detailHampstead weather: Partly Cloudy, 34°F
Other city weather along MD 833
GoHampstead weather forcasts
include_once("GeoCalc.class.php");
include_once("ws_client.php");
include_once("utils.php");
function getStateFromLaln($laln) {
$ret = getWebService("citystate", $laln);
$t = explode(",", $ret);
return $t[1];
}
function getWeatherAlertCountForState($state) {
$weather_alerts = getWeatherEvents($state);
$t = explode("||", $weather_alerts);
$size1 = count($t);
return $size1;
}
function getWeatherAlertsForState($state) {
$weather_alerts = getWeatherEvents($state);
$t = explode("||", $weather_alerts);
return $t;
}
function getWeatherAlertCount($hwy,$state) {
// wrong order on the server
$bbox = getBboxForRoadInState($hwy,$state);
//if($state == "TX")
//echo $bbox."\r\n";
$weather_alerts = getWeatherEvents($state);
$t = explode("||", $weather_alerts);
$t2 = explode(",", $bbox);
$laMax = floatVal($t2[0]);
$lnMin = floatVal($t2[1]);
$laMin = floatVal($t2[2]);
$lnMax = floatVal($t2[3]);
$size1 = count($t);
$alerts_count = 0;
$oGC = new GeoCalc();
for($i=0;$i<$size1;$i++) {
$t1 = explode(";;",$t[$i]);
$fips6 = $t1[5];
// wrong order on the server
$bboxCo = getCountyBbox($fips6);
$laCoMax = floatVal($bboxCo[0]);
$lnCoMin = floatVal($bboxCo[1]);
$laCoMin = floatVal($bboxCo[2]);
$lnCoMax = floatVal($bboxCo[3]);
//if($state == "TX")
//echo "$laCoMax,$lnCoMin,$laCoMin,$lnCoMax\r\n";
if($oGC->isBboxOverlap($laMin,$lnMin,$laMax,$lnMax,$laCoMin,$lnCoMin,$laCoMax,$lnCoMax)) {
$alerts_count++;
}
}
return $alerts_count;
}
function getWeatherAlertsForLaln($la, $ln, $radius) {
if(!isset($radius) || $radius == 0) $radius = 10;
$oGC = new GeoCalc();
$bbox = $oGC->getBbox($la, $ln, $radius);
return getWeatherAlertsForBbox($bbox, "$la,$ln");
}
function getWeatherAlertsForBbox($bbox, $laln) {
$state = getStateFromLaln($laln);
//echo "$state,$bbox,$laln\r\n";
$weather_alerts = getWeatherEvents($state);
//echo $weather_alerts;
$t = explode("||", $weather_alerts);
$oGC = new GeoCalc();
$size1 = count($t);
$bboxWeatherAlerts = "";
for($i=0;$i<$size1;$i++) {
$t1 = explode(";;",$t[$i]);
$fips6 = $t1[5];
$bboxCo = getCountyBbox($fips6);
//print_r($bboxCo) ;
$laCoMax = floatVal($bboxCo[0]);
$lnCoMin = floatVal($bboxCo[1]);
$laCoMin = floatVal($bboxCo[2]);
$lnCoMax = floatVal($bboxCo[3]);
//echo "$laCoMax,$lnCoMin,$laCoMin,$lnCoMax\r\n";
//echo "OKbefore
";
if($oGC->isBboxOverlap($bbox[0],$bbox[1],$bbox[2],$bbox[3],$laCoMin,$lnCoMin,$laCoMax,$lnCoMax)) {
//echo "OKafter
";
//echo $bbox[0] . "," . $bbox[1] . "\r\n";
$laCoMid = ($laCoMax+$laCoMin)/2.0;
$lnCoMid = ($lnCoMax+$lnCoMin)/2.0;
$alerts = $t1[0] . ";;" . $t1[1] . ";;" . $t1[2] . ";;" . $t1[3] . ";;" . $t1[4] . ";;$laCoMid,$lnCoMid";
if(strlen($bboxWeatherAlerts) > 0)
$bboxWeatherAlerts = $bboxWeatherAlerts . "||" . $alerts;
else
$bboxWeatherAlerts = $alerts;
//echo $bbox[0] . "," . $bbox[1] . "\r\n";
}
}
//echo "OK$bboxWeatherAlerts";
return $bboxWeatherAlerts;
}
/*
$la = 34.049482;
$ln=-118.242931;
$radius = 30;
echo getWeatherAlertsForLaln($la, $ln, $radius);
*/
?>