15
15
public function getClosestImage($obsTime, $src) {
16
$query = sprintf("SELECT image.uri AS uri, image.lengthX as width, image.lengthY as height, image.imgScaleX as naturalImageScale,
16
$query = sprintf("SELECT image.id as mysqlId, image.lengthX as width, image.lengthY as height, image.imgScaleX as naturalImageScale,
17
17
measurement.abbreviation AS measurement, measurementType.name AS measurementType, unit,
18
18
CONCAT(instrument.name, \" \", detector.name, \" \", measurement.name) AS name, detector.minZoom as minZoom,
19
19
detector.abbreviation AS detector, detector.opacityGroupId AS opacityGroupId,
43
43
$query .= " ORDER BY timediffAbs LIMIT 0,1";
45
//echo "<br><br>$query<br><br>";
45
//echo "$query<br><br>";
48
48
$result = $this->dbConnection->query($query);
49
return mysqli_fetch_array($result, MYSQL_ASSOC);
49
$im = mysqli_fetch_array($result, MYSQL_ASSOC);
52
$im["uri"] = $this->idToURI($im["mysqlId"]);
54
59
* @author Keith Hughitt <Vincent.K.Hughitt@nasa.gov>
55
60
* @return string $url
56
61
* @param object $obsTime
65
public function getJP2Location($obsTime, $src) {
70
public function getJP2Filename($obsTime, $src) {
67
72
$id = $this->getJP2Id($obsTime, $src);
69
74
// Use ID to find the JP2 URL
70
$query = "SELECT uri as url FROM image WHERE id=$id";
75
return $this->idToURI($id);
81
* @param object $obsTime
84
public function getJP2Id ($obsTime, $src) {
85
$query = sprintf("SELECT image.id as id, ABS(UNIX_TIMESTAMP(timestamp) - %d) AS timediffAbs
87
LEFT JOIN measurement on measurementId = measurement.id
88
LEFT JOIN detector on detectorId = detector.id
89
LEFT JOIN instrument on instrumentId = instrument.id
90
LEFT JOIN observatory on observatoryId = observatory.id
95
foreach($src as $key => $value) {
96
if ($i>0) $query .= " AND";
97
$query .= sprintf(" $key='%s'", mysqli_real_escape_string($this->dbConnection->link, $value));
100
$query .= " ORDER BY timediffAbs LIMIT 0,1";
102
$result = $this->dbConnection->query($query);
103
$result_array = mysqli_fetch_array($result, MYSQL_ASSOC);
105
return $result_array["id"];
113
private function idToURI ($id) {
114
$query = "SELECT uri FROM image WHERE id = $id";
71
115
$result = $this->dbConnection->query($query);
72
$result_array = mysqli_fetch_array($result, MYSQL_ASSOC);
74
return $result_array["url"];
116
$result_array = mysqli_fetch_array($result, MYSQL_ASSOC);
118
return $result_array["uri"];
b'\\ No newline at end of file'