- fixed quantità
- creazione mappa numero utenti per provincia !
This commit is contained in:
@@ -7,6 +7,8 @@ require('../models/subscribers');
|
||||
|
||||
const printf = require('util').format;
|
||||
|
||||
const axios = require('axios');
|
||||
|
||||
const CryptoJS = require('crypto-js');
|
||||
const Url = require('url-parse');
|
||||
|
||||
@@ -4879,4 +4881,22 @@ module.exports = {
|
||||
}
|
||||
},
|
||||
|
||||
// Funzione per ottenere le coordinate di una singola città
|
||||
async getCityCoordinates(city) {
|
||||
try {
|
||||
const response = await axios.get(`https://nominatim.openstreetmap.org/search?format=json&q=${city.descr},${city.prov},Italia`);
|
||||
if (response.data.length > 0) {
|
||||
city.lat = parseFloat(response.data[0].lat);
|
||||
city.long = parseFloat(response.data[0].lon);
|
||||
// console.log(`${city.descr}: Lat ${city.lat}, Long ${city.long}`);
|
||||
return city;
|
||||
} else {
|
||||
console.error(`Coordinate non trovate per ${city.descr}, ${city.prov}`);
|
||||
}
|
||||
return null;
|
||||
} catch (error) {
|
||||
console.error(`Errore durante il recupero delle coordinate per ${city.descr}, ${city.prov}:`, error.message);
|
||||
}
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user