Sats
This commit is contained in:
@@ -108,11 +108,14 @@ export async function queryDaily(start, end) {
|
||||
|
||||
export async function getCoords() {
|
||||
const c = cfg();
|
||||
if(c.LATITUDE !== 0 && c.LONGITUDE !== 0 && c.ALTITUDE !== 0)
|
||||
return {latitude: c.LATITUDE, longitude: c.LONGITUDE, altitude: c.ALTITUDE};
|
||||
|
||||
const results = await queryInstant(c, `{__name__=~"latitude|longitude|altitude"}`);
|
||||
const fields = metricToFields(results);
|
||||
|
||||
if (fields.latitude && fields.longitude) {
|
||||
if(fields.latitude && fields.longitude) {
|
||||
return {latitude: fields.latitude, longitude: fields.longitude, altitude: fields.altitude || c.ALTITUDE};
|
||||
}
|
||||
return {latitude: c.LATITUDE, longitude: c.LONGITUDE, altitude: c.ALTITUDE};
|
||||
return {latitude: 0, longitude: 0, altitude: 0};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user