getCityCoords added
remove 'noise_' on every value
This commit is contained in:
+2
-2
@@ -9,7 +9,7 @@ const DEFAULT_DISTANCE = 10
|
||||
|
||||
// Value to use fpr map
|
||||
const value4map = [
|
||||
{ typ: 'noise', value: 'noise_LA_max'},
|
||||
{ typ: 'noise', value: 'LA_max'},
|
||||
{ typ: 'pm', value: 'P1'},
|
||||
{ typ: 'thp', value: 'temperature'},
|
||||
{ typ: 'radioactivity', value: 'counts_per_minute'},
|
||||
@@ -29,7 +29,7 @@ const getValue4Map = (t) => {
|
||||
const vtype2measurement = {
|
||||
P1: 'pm', P2: 'pm', P0: 'pm',
|
||||
temperature: 'thp', humidity: 'thp', pressure: 'thp',
|
||||
noise_LAeq: 'noise',
|
||||
LAeq: 'noise',
|
||||
counts_per_minute: 'radioactivity'
|
||||
};
|
||||
|
||||
|
||||
@@ -2,8 +2,27 @@ import {returnOnError} from "../utilities/reporterror.js"
|
||||
import axios from 'axios'
|
||||
import {logit} from "../utilities/logit.js"
|
||||
import {getOneProperty} from "./getproperties.js"
|
||||
import { response } from "express"
|
||||
|
||||
const NOMINATIM_URL = `https://nominatim.openstreetmap.org/reverse?lat=${'xx'}&lon=${'yy'}&format=json`
|
||||
const NOMINATIM_CITY_URL = `https://nominatim.openstreetmap.org/?q="${'xx'}"&format=json`
|
||||
|
||||
export const getCityCoords = async (params) => {
|
||||
let ret = {coords: [], city: params.city, err: null}
|
||||
let url = NOMINATIM_CITY_URL.replace('xx', params.city)
|
||||
// let url = 'https://nominatim.openstreetmap.org/?q="K%C3%B6ln"&format=json'
|
||||
try {
|
||||
const response = await axios(url)
|
||||
if (response.status !== 200) {
|
||||
return returnOnError(ret, 'RESPSTATUS', getCityCoord.name, response.status)
|
||||
}
|
||||
ret.coords = [response.data[0].lat,response.data[0].lon]
|
||||
logit(JSON.stringify(ret.coords))
|
||||
} catch (e) {
|
||||
return returnOnError(ret, e, getCityCoords.name)
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
export const getAddress = async (params) => {
|
||||
let ret = {address: "", err: null}
|
||||
|
||||
@@ -250,8 +250,8 @@ export var getLongAvg = async (params) => {
|
||||
// return
|
||||
// JSON
|
||||
// { avgs: [
|
||||
// { location: [ 9.00, 48.80 ], id: 29174, lastSeen: "2019-10-23T12:03:00.000Z", noise_max: "65" }
|
||||
// { location: [ 9.10, 49.80 ], id: 28194, lastSeen: "2019-10-22T16:03:00.000Z", noise_max: "45" }
|
||||
// { location: [ 9.00, 48.80 ], id: 29174, lastSeen: "2019-10-23T12:03:00.000Z", max: "65" }
|
||||
// { location: [ 9.10, 49.80 ], id: 28194, lastSeen: "2019-10-22T16:03:00.000Z", max: "45" }
|
||||
// .........
|
||||
// ], lastDate: "2019-10-29T15:05:59.000Z" }
|
||||
//
|
||||
@@ -295,8 +295,8 @@ export const getMAPaktData = async (opt) => {
|
||||
oneAktData['noise_max'] = -1 // -1 zurückgeben
|
||||
} else {
|
||||
oneAktData['noise_max'] = -5 // bedutet -> nicht anzeigen
|
||||
if (item.values.hasOwnProperty('noise_LA_max')) {
|
||||
oneAktData['noise_max'] = item.values.noise_LA_max.toFixed(0) // und merken
|
||||
if (item.values.hasOwnProperty('LA_max')) {
|
||||
oneAktData['noise_max'] = item.values.LA_max.toFixed(0) // und merken
|
||||
}
|
||||
if (dati > lastDate) {
|
||||
lastDate = dati
|
||||
|
||||
Reference in New Issue
Block a user