<?php

$site_root = $_SERVER['DOCUMENT_ROOT'];
require_once "{$site_root}/models/identity/model.php";
//require_once("$site_root/form-validate.php");
// These are manual data
$lat = -33.818884;
$lng = 151.033354;
$radius = 50;
$datetime = '07-10-2010 14:00:00';
//'201010071430';
$numresults = 500;
$pollutant = 'pm10';
$modeltype = 'idw';
$maxfit = 'true';
echo microtime(true) . "\n";
$grid = model_pollutant_grid($lat, $lng, $radius, $datetime, $numresults, $pollutant, $modeltype, $maxfit);
echo microtime(true) . "\n";
$img = draw_gnuplot($grid);
header("Content-type: image/png");
imagepng($img);
?>



function model_pollutant_image_gnuplot($latitude, $longitude, $radius, $datetime, $numresults, $pollutant, $modeltype, $maxfit)
{
    $array = model_pollutant_grid($latitude, $longitude, $radius, $datetime, $numresults, $pollutant, $modeltype, $maxfit);
    draw_gnuplot($array);
}