better stations list
This commit is contained in:
parent
e81fd75e67
commit
c8c04288b9
10
.vscode/launch.json
vendored
10
.vscode/launch.json
vendored
|
@ -4,6 +4,7 @@
|
||||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||||
"version": "0.2.0",
|
"version": "0.2.0",
|
||||||
"configurations": [
|
"configurations": [
|
||||||
|
|
||||||
{
|
{
|
||||||
"name": "Frontend",
|
"name": "Frontend",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
|
@ -15,6 +16,15 @@
|
||||||
"**/*.min.js",
|
"**/*.min.js",
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "Data:stations",
|
||||||
|
"program": "${workspaceFolder}/datagenerators/stations.js",
|
||||||
|
"request": "launch",
|
||||||
|
"skipFiles": [
|
||||||
|
"<node_internals>/**"
|
||||||
|
],
|
||||||
|
"type": "pwa-node"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "node",
|
"type": "node",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
|
|
24
datagenerators/https.js
Normal file
24
datagenerators/https.js
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
// async https wrapper
|
||||||
|
|
||||||
|
const https = require('https');
|
||||||
|
|
||||||
|
module.exports = (url) => new Promise((resolve, reject) => {
|
||||||
|
const headers = {};
|
||||||
|
headers['user-agent'] = '(WeatherStar 4000+ data generator, ws4000@netbymatt.com)';
|
||||||
|
|
||||||
|
https.get(url, {
|
||||||
|
headers,
|
||||||
|
}, res => {
|
||||||
|
if (res.statusCode === 200) {
|
||||||
|
const buffers = [];
|
||||||
|
res.on('data', data => buffers.push(data));
|
||||||
|
res.on('end', () => resolve(Buffer.concat(buffers).toString()));
|
||||||
|
} else {
|
||||||
|
console.log(res);
|
||||||
|
reject(new Error(`Unable to get: ${url}`));
|
||||||
|
}
|
||||||
|
}).on('error', e=> {
|
||||||
|
console.log(e);
|
||||||
|
reject(e);
|
||||||
|
});
|
||||||
|
});
|
19547
datagenerators/output/stations - Copy.js
Normal file
19547
datagenerators/output/stations - Copy.js
Normal file
File diff suppressed because it is too large
Load diff
3334
datagenerators/output/stations.js
Normal file
3334
datagenerators/output/stations.js
Normal file
File diff suppressed because it is too large
Load diff
53
datagenerators/stations-states.js
Normal file
53
datagenerators/stations-states.js
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
module.exports = [
|
||||||
|
'AZ',
|
||||||
|
'AL',
|
||||||
|
'AK',
|
||||||
|
'AR',
|
||||||
|
'CA',
|
||||||
|
'CO',
|
||||||
|
'CT',
|
||||||
|
'DE',
|
||||||
|
'FL',
|
||||||
|
'GA',
|
||||||
|
'HI',
|
||||||
|
'ID',
|
||||||
|
'IL',
|
||||||
|
'IN',
|
||||||
|
'IA',
|
||||||
|
'KS',
|
||||||
|
'KY',
|
||||||
|
'LA',
|
||||||
|
'ME',
|
||||||
|
'MD',
|
||||||
|
'MA',
|
||||||
|
'MI',
|
||||||
|
'MN',
|
||||||
|
'MS',
|
||||||
|
'MO',
|
||||||
|
'MT',
|
||||||
|
'NE',
|
||||||
|
'NV',
|
||||||
|
'NH',
|
||||||
|
'NJ',
|
||||||
|
'NM',
|
||||||
|
'NY',
|
||||||
|
'NC',
|
||||||
|
'ND',
|
||||||
|
'OH',
|
||||||
|
'OK',
|
||||||
|
'OR',
|
||||||
|
'PA',
|
||||||
|
'RI',
|
||||||
|
'SC',
|
||||||
|
'SD',
|
||||||
|
'TN',
|
||||||
|
'TX',
|
||||||
|
'UT',
|
||||||
|
'VT',
|
||||||
|
'VA',
|
||||||
|
'WA',
|
||||||
|
'WV',
|
||||||
|
'WI',
|
||||||
|
'WY',
|
||||||
|
'PR',
|
||||||
|
];
|
54
datagenerators/stations.js
Normal file
54
datagenerators/stations.js
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
// list all stations in a single file
|
||||||
|
// only find stations with 4 letter codes
|
||||||
|
|
||||||
|
const https = require('./https');
|
||||||
|
const fs = require('fs');
|
||||||
|
const path = require('path');
|
||||||
|
|
||||||
|
// immediately invoked function so we can access async/await
|
||||||
|
const start = async () => {
|
||||||
|
// load the list of states
|
||||||
|
const states = ['AK', 'NC', 'VA', 'TX', 'GA', 'PR'];
|
||||||
|
// const states = require('./stations-states.js');
|
||||||
|
|
||||||
|
let output = {};
|
||||||
|
// loop through states
|
||||||
|
await Promise.all(states.map(async (state) => {
|
||||||
|
try {
|
||||||
|
// get list and parse the JSON
|
||||||
|
const stationsRaw = await https(`https://api.weather.gov/stations?state=${state}`);
|
||||||
|
const stationsAll = JSON.parse(stationsRaw).features;
|
||||||
|
// filter stations for 4 letter identifiers
|
||||||
|
const stations = stationsAll.filter(station => station.properties.stationIdentifier.match(/^[A-Z]{4}$/));
|
||||||
|
// add each resulting station to the output
|
||||||
|
stations.forEach(station => {
|
||||||
|
const id = station.properties.stationIdentifier;
|
||||||
|
if (output[id]) {
|
||||||
|
console.log(`Duplicate station: ${state}-${id}`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
output[id] = {
|
||||||
|
id,
|
||||||
|
city: station.properties.name,
|
||||||
|
state: state,
|
||||||
|
lat: station.geometry.coordinates[1],
|
||||||
|
lon: station.geometry.coordinates[0],
|
||||||
|
};
|
||||||
|
});
|
||||||
|
console.log(`Complete: ${state}`);
|
||||||
|
} catch (e) {
|
||||||
|
console.error(`Unable to get state: ${state}`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
|
||||||
|
// write the output
|
||||||
|
fs.writeFileSync(path.join(__dirname, 'output/stations.js'), JSON.stringify(output, null, 2));
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
// immediately invoked function allows access to async
|
||||||
|
(async () => {
|
||||||
|
await start();
|
||||||
|
})();
|
||||||
|
|
|
@ -1,584 +1,584 @@
|
||||||
// eslint-disable-next-line no-unused-vars
|
// eslint-disable-next-line no-unused-vars
|
||||||
const _RegionalCities = [
|
const _RegionalCities = [
|
||||||
{
|
{
|
||||||
Name: 'Atlanta',
|
city: 'Atlanta',
|
||||||
Latitude: 33.749,
|
lat: 33.749,
|
||||||
Longitude: -84.388,
|
lon: -84.388,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Boston',
|
city: 'Boston',
|
||||||
Latitude: 42.3584,
|
lat: 42.3584,
|
||||||
Longitude: -71.0598,
|
lon: -71.0598,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Chicago',
|
city: 'Chicago',
|
||||||
Latitude: 41.9796,
|
lat: 41.9796,
|
||||||
Longitude: -87.9045,
|
lon: -87.9045,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Cleveland',
|
city: 'Cleveland',
|
||||||
Latitude: 41.4995,
|
lat: 41.4995,
|
||||||
Longitude: -81.6954,
|
lon: -81.6954,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Dallas',
|
city: 'Dallas',
|
||||||
Latitude: 32.8959,
|
lat: 32.8959,
|
||||||
Longitude: -97.0372,
|
lon: -97.0372,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Denver',
|
city: 'Denver',
|
||||||
Latitude: 39.7391,
|
lat: 39.7391,
|
||||||
Longitude: -104.9847,
|
lon: -104.9847,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Detroit',
|
city: 'Detroit',
|
||||||
Latitude: 42.3314,
|
lat: 42.3314,
|
||||||
Longitude: -83.0457,
|
lon: -83.0457,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Hartford',
|
city: 'Hartford',
|
||||||
Latitude: 41.7637,
|
lat: 41.7637,
|
||||||
Longitude: -72.6851,
|
lon: -72.6851,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Houston',
|
city: 'Houston',
|
||||||
Latitude: 29.7633,
|
lat: 29.7633,
|
||||||
Longitude: -95.3633,
|
lon: -95.3633,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Indianapolis',
|
city: 'Indianapolis',
|
||||||
Latitude: 39.7684,
|
lat: 39.7684,
|
||||||
Longitude: -86.158,
|
lon: -86.158,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Los Angeles',
|
city: 'Los Angeles',
|
||||||
Latitude: 34.0522,
|
lat: 34.0522,
|
||||||
Longitude: -118.2437,
|
lon: -118.2437,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Miami',
|
city: 'Miami',
|
||||||
Latitude: 25.7743,
|
lat: 25.7743,
|
||||||
Longitude: -80.1937,
|
lon: -80.1937,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Minneapolis',
|
city: 'Minneapolis',
|
||||||
Latitude: 44.98,
|
lat: 44.98,
|
||||||
Longitude: -93.2638,
|
lon: -93.2638,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'New York',
|
city: 'New York',
|
||||||
Latitude: 40.78,
|
lat: 40.78,
|
||||||
Longitude: -73.88,
|
lon: -73.88,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Norfolk',
|
city: 'Norfolk',
|
||||||
Latitude: 36.8468,
|
lat: 36.8468,
|
||||||
Longitude: -76.2852,
|
lon: -76.2852,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Orlando',
|
city: 'Orlando',
|
||||||
Latitude: 28.5383,
|
lat: 28.5383,
|
||||||
Longitude: -81.3792,
|
lon: -81.3792,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Philadelphia',
|
city: 'Philadelphia',
|
||||||
Latitude: 39.9523,
|
lat: 39.9523,
|
||||||
Longitude: -75.1638,
|
lon: -75.1638,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Pittsburgh',
|
city: 'Pittsburgh',
|
||||||
Latitude: 40.4406,
|
lat: 40.4406,
|
||||||
Longitude: -79.9959,
|
lon: -79.9959,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'St. Louis',
|
city: 'St. Louis',
|
||||||
Latitude: 38.6273,
|
lat: 38.6273,
|
||||||
Longitude: -90.1979,
|
lon: -90.1979,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'San Francisco',
|
city: 'San Francisco',
|
||||||
Latitude: 37.6148,
|
lat: 37.6148,
|
||||||
Longitude: -122.3918,
|
lon: -122.3918,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Seattle',
|
city: 'Seattle',
|
||||||
Latitude: 47.6062,
|
lat: 47.6062,
|
||||||
Longitude: -122.3321,
|
lon: -122.3321,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Syracuse',
|
city: 'Syracuse',
|
||||||
Latitude: 43.0481,
|
lat: 43.0481,
|
||||||
Longitude: -76.1474,
|
lon: -76.1474,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Tampa',
|
city: 'Tampa',
|
||||||
Latitude: 27.9756,
|
lat: 27.9756,
|
||||||
Longitude: -82.5329,
|
lon: -82.5329,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Washington DC',
|
city: 'Washington DC',
|
||||||
Latitude: 38.8951,
|
lat: 38.8951,
|
||||||
Longitude: -77.0364,
|
lon: -77.0364,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Albany',
|
city: 'Albany',
|
||||||
Latitude: 42.6526,
|
lat: 42.6526,
|
||||||
Longitude: -73.7562,
|
lon: -73.7562,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Albuquerque',
|
city: 'Albuquerque',
|
||||||
Latitude: 35.0845,
|
lat: 35.0845,
|
||||||
Longitude: -106.6511,
|
lon: -106.6511,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Amarillo',
|
city: 'Amarillo',
|
||||||
Latitude: 35.222,
|
lat: 35.222,
|
||||||
Longitude: -101.8313,
|
lon: -101.8313,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Anchorage',
|
city: 'Anchorage',
|
||||||
Latitude: 61.2181,
|
lat: 61.2181,
|
||||||
Longitude: -149.9003,
|
lon: -149.9003,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Austin',
|
city: 'Austin',
|
||||||
Latitude: 30.2671,
|
lat: 30.2671,
|
||||||
Longitude: -97.7431,
|
lon: -97.7431,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Baker',
|
city: 'Baker',
|
||||||
Latitude: 44.7502,
|
lat: 44.7502,
|
||||||
Longitude: -117.6677,
|
lon: -117.6677,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Baltimore',
|
city: 'Baltimore',
|
||||||
Latitude: 39.2904,
|
lat: 39.2904,
|
||||||
Longitude: -76.6122,
|
lon: -76.6122,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Bangor',
|
city: 'Bangor',
|
||||||
Latitude: 44.8012,
|
lat: 44.8012,
|
||||||
Longitude: -68.7778,
|
lon: -68.7778,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Birmingham',
|
city: 'Birmingham',
|
||||||
Latitude: 33.5207,
|
lat: 33.5207,
|
||||||
Longitude: -86.8025,
|
lon: -86.8025,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Bismarck',
|
city: 'Bismarck',
|
||||||
Latitude: 46.8083,
|
lat: 46.8083,
|
||||||
Longitude: -100.7837,
|
lon: -100.7837,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Boise',
|
city: 'Boise',
|
||||||
Latitude: 43.6135,
|
lat: 43.6135,
|
||||||
Longitude: -116.2034,
|
lon: -116.2034,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Buffalo',
|
city: 'Buffalo',
|
||||||
Latitude: 42.8864,
|
lat: 42.8864,
|
||||||
Longitude: -78.8784,
|
lon: -78.8784,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Carlsbad',
|
city: 'Carlsbad',
|
||||||
Latitude: 32.4207,
|
lat: 32.4207,
|
||||||
Longitude: -104.2288,
|
lon: -104.2288,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Charleston',
|
city: 'Charleston',
|
||||||
Latitude: 32.7766,
|
lat: 32.7766,
|
||||||
Longitude: -79.9309,
|
lon: -79.9309,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Charleston',
|
city: 'Charleston',
|
||||||
Latitude: 38.3498,
|
lat: 38.3498,
|
||||||
Longitude: -81.6326,
|
lon: -81.6326,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Charlotte',
|
city: 'Charlotte',
|
||||||
Latitude: 35.2271,
|
lat: 35.2271,
|
||||||
Longitude: -80.8431,
|
lon: -80.8431,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Cheyenne',
|
city: 'Cheyenne',
|
||||||
Latitude: 41.14,
|
lat: 41.14,
|
||||||
Longitude: -104.8202,
|
lon: -104.8202,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Cincinnati',
|
city: 'Cincinnati',
|
||||||
Latitude: 39.162,
|
lat: 39.162,
|
||||||
Longitude: -84.4569,
|
lon: -84.4569,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Columbia',
|
city: 'Columbia',
|
||||||
Latitude: 34.0007,
|
lat: 34.0007,
|
||||||
Longitude: -81.0348,
|
lon: -81.0348,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Columbus',
|
city: 'Columbus',
|
||||||
Latitude: 39.9612,
|
lat: 39.9612,
|
||||||
Longitude: -82.9988,
|
lon: -82.9988,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Des Moines',
|
city: 'Des Moines',
|
||||||
Latitude: 41.6005,
|
lat: 41.6005,
|
||||||
Longitude: -93.6091,
|
lon: -93.6091,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Dubuque',
|
city: 'Dubuque',
|
||||||
Latitude: 42.5006,
|
lat: 42.5006,
|
||||||
Longitude: -90.6646,
|
lon: -90.6646,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Duluth',
|
city: 'Duluth',
|
||||||
Latitude: 46.7833,
|
lat: 46.7833,
|
||||||
Longitude: -92.1066,
|
lon: -92.1066,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Eastport',
|
city: 'Eastport',
|
||||||
Latitude: 44.9062,
|
lat: 44.9062,
|
||||||
Longitude: -66.99,
|
lon: -66.99,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'El Centro',
|
city: 'El Centro',
|
||||||
Latitude: 32.792,
|
lat: 32.792,
|
||||||
Longitude: -115.563,
|
lon: -115.563,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'El Paso',
|
city: 'El Paso',
|
||||||
Latitude: 31.7587,
|
lat: 31.7587,
|
||||||
Longitude: -106.4869,
|
lon: -106.4869,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Eugene',
|
city: 'Eugene',
|
||||||
Latitude: 44.0521,
|
lat: 44.0521,
|
||||||
Longitude: -123.0867,
|
lon: -123.0867,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Fargo',
|
city: 'Fargo',
|
||||||
Latitude: 46.8772,
|
lat: 46.8772,
|
||||||
Longitude: -96.7898,
|
lon: -96.7898,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Flagstaff',
|
city: 'Flagstaff',
|
||||||
Latitude: 35.1981,
|
lat: 35.1981,
|
||||||
Longitude: -111.6513,
|
lon: -111.6513,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Fresno',
|
city: 'Fresno',
|
||||||
Latitude: 36.7477,
|
lat: 36.7477,
|
||||||
Longitude: -119.7724,
|
lon: -119.7724,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Grand Junction',
|
city: 'Grand Junction',
|
||||||
Latitude: 39.0639,
|
lat: 39.0639,
|
||||||
Longitude: -108.5506,
|
lon: -108.5506,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Grand Rapids',
|
city: 'Grand Rapids',
|
||||||
Latitude: 42.9634,
|
lat: 42.9634,
|
||||||
Longitude: -85.6681,
|
lon: -85.6681,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Havre',
|
city: 'Havre',
|
||||||
Latitude: 48.55,
|
lat: 48.55,
|
||||||
Longitude: -109.6841,
|
lon: -109.6841,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Helena',
|
city: 'Helena',
|
||||||
Latitude: 46.5927,
|
lat: 46.5927,
|
||||||
Longitude: -112.0361,
|
lon: -112.0361,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Honolulu',
|
city: 'Honolulu',
|
||||||
Latitude: 21.3069,
|
lat: 21.3069,
|
||||||
Longitude: -157.8583,
|
lon: -157.8583,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Hot Springs',
|
city: 'Hot Springs',
|
||||||
Latitude: 34.5037,
|
lat: 34.5037,
|
||||||
Longitude: -93.0552,
|
lon: -93.0552,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Idaho Falls',
|
city: 'Idaho Falls',
|
||||||
Latitude: 43.4666,
|
lat: 43.4666,
|
||||||
Longitude: -112.0341,
|
lon: -112.0341,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Jackson',
|
city: 'Jackson',
|
||||||
Latitude: 32.2988,
|
lat: 32.2988,
|
||||||
Longitude: -90.1848,
|
lon: -90.1848,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Jacksonville',
|
city: 'Jacksonville',
|
||||||
Latitude: 30.3322,
|
lat: 30.3322,
|
||||||
Longitude: -81.6556,
|
lon: -81.6556,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Juneau',
|
city: 'Juneau',
|
||||||
Latitude: 58.3019,
|
lat: 58.3019,
|
||||||
Longitude: -134.4197,
|
lon: -134.4197,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Kansas City',
|
city: 'Kansas City',
|
||||||
Latitude: 39.1142,
|
lat: 39.1142,
|
||||||
Longitude: -94.6275,
|
lon: -94.6275,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Key West',
|
city: 'Key West',
|
||||||
Latitude: 24.5557,
|
lat: 24.5557,
|
||||||
Longitude: -81.7826,
|
lon: -81.7826,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Klamath Falls',
|
city: 'Klamath Falls',
|
||||||
Latitude: 42.2249,
|
lat: 42.2249,
|
||||||
Longitude: -121.7817,
|
lon: -121.7817,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Knoxville',
|
city: 'Knoxville',
|
||||||
Latitude: 35.9606,
|
lat: 35.9606,
|
||||||
Longitude: -83.9207,
|
lon: -83.9207,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Las Vegas',
|
city: 'Las Vegas',
|
||||||
Latitude: 36.175,
|
lat: 36.175,
|
||||||
Longitude: -115.1372,
|
lon: -115.1372,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Lewiston',
|
city: 'Lewiston',
|
||||||
Latitude: 46.4165,
|
lat: 46.4165,
|
||||||
Longitude: -117.0177,
|
lon: -117.0177,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Lincoln',
|
city: 'Lincoln',
|
||||||
Latitude: 40.8,
|
lat: 40.8,
|
||||||
Longitude: -96.667,
|
lon: -96.667,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Long Beach',
|
city: 'Long Beach',
|
||||||
Latitude: 33.767,
|
lat: 33.767,
|
||||||
Longitude: -118.1892,
|
lon: -118.1892,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Louisville',
|
city: 'Louisville',
|
||||||
Latitude: 38.2542,
|
lat: 38.2542,
|
||||||
Longitude: -85.7594,
|
lon: -85.7594,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Manchester',
|
city: 'Manchester',
|
||||||
Latitude: 42.9956,
|
lat: 42.9956,
|
||||||
Longitude: -71.4548,
|
lon: -71.4548,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Memphis',
|
city: 'Memphis',
|
||||||
Latitude: 35.1495,
|
lat: 35.1495,
|
||||||
Longitude: -90.049,
|
lon: -90.049,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Milwaukee',
|
city: 'Milwaukee',
|
||||||
Latitude: 43.0389,
|
lat: 43.0389,
|
||||||
Longitude: -87.9065,
|
lon: -87.9065,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Mobile',
|
city: 'Mobile',
|
||||||
Latitude: 30.6944,
|
lat: 30.6944,
|
||||||
Longitude: -88.043,
|
lon: -88.043,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Montgomery',
|
city: 'Montgomery',
|
||||||
Latitude: 32.3668,
|
lat: 32.3668,
|
||||||
Longitude: -86.3,
|
lon: -86.3,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Montpelier',
|
city: 'Montpelier',
|
||||||
Latitude: 44.2601,
|
lat: 44.2601,
|
||||||
Longitude: -72.5754,
|
lon: -72.5754,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Nashville',
|
city: 'Nashville',
|
||||||
Latitude: 36.1659,
|
lat: 36.1659,
|
||||||
Longitude: -86.7844,
|
lon: -86.7844,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Newark',
|
city: 'Newark',
|
||||||
Latitude: 40.7357,
|
lat: 40.7357,
|
||||||
Longitude: -74.1724,
|
lon: -74.1724,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'New Haven',
|
city: 'New Haven',
|
||||||
Latitude: 41.3081,
|
lat: 41.3081,
|
||||||
Longitude: -72.9282,
|
lon: -72.9282,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'New Orleans',
|
city: 'New Orleans',
|
||||||
Latitude: 29.9546,
|
lat: 29.9546,
|
||||||
Longitude: -90.0751,
|
lon: -90.0751,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Nome',
|
city: 'Nome',
|
||||||
Latitude: 64.5011,
|
lat: 64.5011,
|
||||||
Longitude: -165.4064,
|
lon: -165.4064,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Oklahoma City',
|
city: 'Oklahoma City',
|
||||||
Latitude: 35.4676,
|
lat: 35.4676,
|
||||||
Longitude: -97.5164,
|
lon: -97.5164,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Omaha',
|
city: 'Omaha',
|
||||||
Latitude: 41.2586,
|
lat: 41.2586,
|
||||||
Longitude: -95.9378,
|
lon: -95.9378,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Phoenix',
|
city: 'Phoenix',
|
||||||
Latitude: 33.4484,
|
lat: 33.4484,
|
||||||
Longitude: -112.074,
|
lon: -112.074,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Pierre',
|
city: 'Pierre',
|
||||||
Latitude: 44.3683,
|
lat: 44.3683,
|
||||||
Longitude: -100.351,
|
lon: -100.351,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Portland',
|
city: 'Portland',
|
||||||
Latitude: 43.6615,
|
lat: 43.6615,
|
||||||
Longitude: -70.2553,
|
lon: -70.2553,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Portland',
|
city: 'Portland',
|
||||||
Latitude: 45.5234,
|
lat: 45.5234,
|
||||||
Longitude: -122.6762,
|
lon: -122.6762,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Providence',
|
city: 'Providence',
|
||||||
Latitude: 41.824,
|
lat: 41.824,
|
||||||
Longitude: -71.4128,
|
lon: -71.4128,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Raleigh',
|
city: 'Raleigh',
|
||||||
Latitude: 35.7721,
|
lat: 35.7721,
|
||||||
Longitude: -78.6386,
|
lon: -78.6386,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Reno',
|
city: 'Reno',
|
||||||
Latitude: 39.4986,
|
lat: 39.4986,
|
||||||
Longitude: -119.7681,
|
lon: -119.7681,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Richfield',
|
city: 'Richfield',
|
||||||
Latitude: 38.7725,
|
lat: 38.7725,
|
||||||
Longitude: -112.0841,
|
lon: -112.0841,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Richmond',
|
city: 'Richmond',
|
||||||
Latitude: 37.5538,
|
lat: 37.5538,
|
||||||
Longitude: -77.4603,
|
lon: -77.4603,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Roanoke',
|
city: 'Roanoke',
|
||||||
Latitude: 37.271,
|
lat: 37.271,
|
||||||
Longitude: -79.9414,
|
lon: -79.9414,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Sacramento',
|
city: 'Sacramento',
|
||||||
Latitude: 38.5816,
|
lat: 38.5816,
|
||||||
Longitude: -121.4944,
|
lon: -121.4944,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Salt Lake City',
|
city: 'Salt Lake City',
|
||||||
Latitude: 40.7608,
|
lat: 40.7608,
|
||||||
Longitude: -111.891,
|
lon: -111.891,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'San Antonio',
|
city: 'San Antonio',
|
||||||
Latitude: 29.4241,
|
lat: 29.4241,
|
||||||
Longitude: -98.4936,
|
lon: -98.4936,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'San Diego',
|
city: 'San Diego',
|
||||||
Latitude: 32.7153,
|
lat: 32.7153,
|
||||||
Longitude: -117.1573,
|
lon: -117.1573,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'San Jose',
|
city: 'San Jose',
|
||||||
Latitude: 37.3394,
|
lat: 37.3394,
|
||||||
Longitude: -121.895,
|
lon: -121.895,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Santa Fe',
|
city: 'Santa Fe',
|
||||||
Latitude: 35.687,
|
lat: 35.687,
|
||||||
Longitude: -105.9378,
|
lon: -105.9378,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Savannah',
|
city: 'Savannah',
|
||||||
Latitude: 32.0835,
|
lat: 32.0835,
|
||||||
Longitude: -81.0998,
|
lon: -81.0998,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Shreveport',
|
city: 'Shreveport',
|
||||||
Latitude: 32.5251,
|
lat: 32.5251,
|
||||||
Longitude: -93.7502,
|
lon: -93.7502,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Sioux Falls',
|
city: 'Sioux Falls',
|
||||||
Latitude: 43.55,
|
lat: 43.55,
|
||||||
Longitude: -96.7003,
|
lon: -96.7003,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Sitka',
|
city: 'Sitka',
|
||||||
Latitude: 57.0531,
|
lat: 57.0531,
|
||||||
Longitude: -135.33,
|
lon: -135.33,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Spokane',
|
city: 'Spokane',
|
||||||
Latitude: 47.6597,
|
lat: 47.6597,
|
||||||
Longitude: -117.4291,
|
lon: -117.4291,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Springfield',
|
city: 'Springfield',
|
||||||
Latitude: 39.8017,
|
lat: 39.8017,
|
||||||
Longitude: -89.6437,
|
lon: -89.6437,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Springfield',
|
city: 'Springfield',
|
||||||
Latitude: 42.1015,
|
lat: 42.1015,
|
||||||
Longitude: -72.5898,
|
lon: -72.5898,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Springfield',
|
city: 'Springfield',
|
||||||
Latitude: 37.2153,
|
lat: 37.2153,
|
||||||
Longitude: -93.2982,
|
lon: -93.2982,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Toledo',
|
city: 'Toledo',
|
||||||
Latitude: 41.6639,
|
lat: 41.6639,
|
||||||
Longitude: -83.5552,
|
lon: -83.5552,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Tulsa',
|
city: 'Tulsa',
|
||||||
Latitude: 36.154,
|
lat: 36.154,
|
||||||
Longitude: -95.9928,
|
lon: -95.9928,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Virginia Beach',
|
city: 'Virginia Beach',
|
||||||
Latitude: 36.8529,
|
lat: 36.8529,
|
||||||
Longitude: -75.978,
|
lon: -75.978,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Wichita',
|
city: 'Wichita',
|
||||||
Latitude: 37.6922,
|
lat: 37.6922,
|
||||||
Longitude: -97.3375,
|
lon: -97.3375,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Wilmington',
|
city: 'Wilmington',
|
||||||
Latitude: 34.2257,
|
lat: 34.2257,
|
||||||
Longitude: -77.9447,
|
lon: -77.9447,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: 'Tuscan',
|
city: 'Tuscan',
|
||||||
Latitude: 32.2216,
|
lat: 32.2216,
|
||||||
Longitude: -110.9698,
|
lon: -110.9698,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -19,7 +19,7 @@ class LatestObservations extends WeatherDisplay {
|
||||||
// calculate distance to each station
|
// calculate distance to each station
|
||||||
const stationsByDistance = Object.keys(_StationInfo).map(key => {
|
const stationsByDistance = Object.keys(_StationInfo).map(key => {
|
||||||
const station = _StationInfo[key];
|
const station = _StationInfo[key];
|
||||||
const distance = utils.calc.distance(station.Latitude, station.Longitude, weatherParameters.latitude, weatherParameters.longitude);
|
const distance = utils.calc.distance(station.lat, station.lon, weatherParameters.latitude, weatherParameters.longitude);
|
||||||
return Object.assign({}, station, {distance});
|
return Object.assign({}, station, {distance});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -33,17 +33,17 @@ class LatestObservations extends WeatherDisplay {
|
||||||
try {
|
try {
|
||||||
const data = await $.ajax({
|
const data = await $.ajax({
|
||||||
type: 'GET',
|
type: 'GET',
|
||||||
url: `https://api.weather.gov/stations/${station.StationId}/observations/latest`,
|
url: `https://api.weather.gov/stations/${station.id}/observations/latest`,
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
crossDomain: true,
|
crossDomain: true,
|
||||||
});
|
});
|
||||||
// format the return values
|
// format the return values
|
||||||
return Object.assign({}, data.properties, {
|
return Object.assign({}, data.properties, {
|
||||||
StationId: station.StationId,
|
StationId: station.id,
|
||||||
City: station.City,
|
city: station.city,
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(`Unable to get latest observations for ${station.StationId}`);
|
console.log(`Unable to get latest observations for ${station.id}`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
@ -95,7 +95,7 @@ class LatestObservations extends WeatherDisplay {
|
||||||
WindSpeed = utils.units.kphToMph(WindSpeed);
|
WindSpeed = utils.units.kphToMph(WindSpeed);
|
||||||
}
|
}
|
||||||
|
|
||||||
draw.text(this.context, 'Star4000', '24pt', '#FFFFFF', 65, y, condition.City.substr(0, 14), 2);
|
draw.text(this.context, 'Star4000', '24pt', '#FFFFFF', 65, y, condition.city.substr(0, 14), 2);
|
||||||
draw.text(this.context, 'Star4000', '24pt', '#FFFFFF', 345, y, this.shortenCurrentConditions(condition.textDescription).substr(0, 9), 2);
|
draw.text(this.context, 'Star4000', '24pt', '#FFFFFF', 345, y, this.shortenCurrentConditions(condition.textDescription).substr(0, 9), 2);
|
||||||
|
|
||||||
if (WindSpeed > 0) {
|
if (WindSpeed > 0) {
|
||||||
|
|
|
@ -69,7 +69,7 @@ const navigation = (() => {
|
||||||
let city = point.properties.relativeLocation.properties.city;
|
let city = point.properties.relativeLocation.properties.city;
|
||||||
|
|
||||||
if (StationId in _StationInfo) {
|
if (StationId in _StationInfo) {
|
||||||
city = _StationInfo[StationId].City;
|
city = _StationInfo[StationId].city;
|
||||||
city = city.split('/')[0];
|
city = city.split('/')[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ class RegionalForecast extends WeatherDisplay {
|
||||||
if (weatherParameters.State === 'HI') targetDistance = 1;
|
if (weatherParameters.State === 'HI') targetDistance = 1;
|
||||||
|
|
||||||
// make station info into an array
|
// make station info into an array
|
||||||
const stationInfoArray = Object.keys(_StationInfo).map(key => Object.assign({}, _StationInfo[key], {Name: _StationInfo[key].City, targetDistance}));
|
const stationInfoArray = Object.keys(_StationInfo).map(key => Object.assign({}, _StationInfo[key], {targetDistance}));
|
||||||
// combine regional cities with station info for additional stations
|
// combine regional cities with station info for additional stations
|
||||||
// stations are intentionally after cities to allow cities priority when drawing the map
|
// stations are intentionally after cities to allow cities priority when drawing the map
|
||||||
const combinedCities = [..._RegionalCities, ...stationInfoArray];
|
const combinedCities = [..._RegionalCities, ...stationInfoArray];
|
||||||
|
@ -52,13 +52,13 @@ class RegionalForecast extends WeatherDisplay {
|
||||||
// Determine which cities are within the max/min latitude/longitude.
|
// Determine which cities are within the max/min latitude/longitude.
|
||||||
const regionalCities = [];
|
const regionalCities = [];
|
||||||
combinedCities.forEach(city => {
|
combinedCities.forEach(city => {
|
||||||
if (city.Latitude > minMaxLatLon.minLat && city.Latitude < minMaxLatLon.maxLat &&
|
if (city.lat > minMaxLatLon.minLat && city.lat < minMaxLatLon.maxLat &&
|
||||||
city.Longitude > minMaxLatLon.minLon && city.Longitude < minMaxLatLon.maxLon - 1) {
|
city.lon > minMaxLatLon.minLon && city.lon < minMaxLatLon.maxLon - 1) {
|
||||||
// default to 1 for cities loaded from _RegionalCities, use value calculate above for remaining stations
|
// default to 1 for cities loaded from _RegionalCities, use value calculate above for remaining stations
|
||||||
const targetDistance = city.targetDistance || 1;
|
const targetDistance = city.targetDistance || 1;
|
||||||
// Only add the city as long as it isn't within set distance degree of any other city already in the array.
|
// Only add the city as long as it isn't within set distance degree of any other city already in the array.
|
||||||
const okToAddCity = regionalCities.reduce((acc, testCity) => {
|
const okToAddCity = regionalCities.reduce((acc, testCity) => {
|
||||||
const distance = utils.calc.distance(city.Longitude, city.Latitude, testCity.Longitude, testCity.Latitude);
|
const distance = utils.calc.distance(city.lon, city.lat, testCity.lon, testCity.lat);
|
||||||
return acc && distance >= targetDistance;
|
return acc && distance >= targetDistance;
|
||||||
}, true);
|
}, true);
|
||||||
if (okToAddCity) regionalCities.push(city);
|
if (okToAddCity) regionalCities.push(city);
|
||||||
|
@ -69,7 +69,7 @@ class RegionalForecast extends WeatherDisplay {
|
||||||
const regionalForecastPromises = regionalCities.map(async city => {
|
const regionalForecastPromises = regionalCities.map(async city => {
|
||||||
try {
|
try {
|
||||||
// get the point first, then break down into forecast and observations
|
// get the point first, then break down into forecast and observations
|
||||||
const point = await utils.weather.getPoint(city.Latitude, city.Longitude);
|
const point = await utils.weather.getPoint(city.lat, city.lon);
|
||||||
|
|
||||||
// start off the observation task
|
// start off the observation task
|
||||||
const observationPromise = this.getRegionalObservation(point, city);
|
const observationPromise = this.getRegionalObservation(point, city);
|
||||||
|
@ -89,7 +89,7 @@ class RegionalForecast extends WeatherDisplay {
|
||||||
const regionalObservation = {
|
const regionalObservation = {
|
||||||
daytime: !!observation.icon.match(/\/day\//),
|
daytime: !!observation.icon.match(/\/day\//),
|
||||||
temperature: utils.units.celsiusToFahrenheit(observation.temperature.value),
|
temperature: utils.units.celsiusToFahrenheit(observation.temperature.value),
|
||||||
name: city.Name,
|
name: this.formatCity(city.city),
|
||||||
icon: observation.icon,
|
icon: observation.icon,
|
||||||
x: cityXY.x,
|
x: cityXY.x,
|
||||||
y: cityXY.y,
|
y: cityXY.y,
|
||||||
|
@ -140,7 +140,7 @@ class RegionalForecast extends WeatherDisplay {
|
||||||
return {
|
return {
|
||||||
daytime: forecast.isDaytime,
|
daytime: forecast.isDaytime,
|
||||||
temperature: forecast.temperature||0,
|
temperature: forecast.temperature||0,
|
||||||
name: city.Name,
|
name: city.city,
|
||||||
icon: forecast.icon,
|
icon: forecast.icon,
|
||||||
x: cityXY.x,
|
x: cityXY.x,
|
||||||
y: cityXY.y,
|
y: cityXY.y,
|
||||||
|
@ -294,8 +294,8 @@ class RegionalForecast extends WeatherDisplay {
|
||||||
getXYForCity (City, MaxLatitude, MinLongitude, state) {
|
getXYForCity (City, MaxLatitude, MinLongitude, state) {
|
||||||
if (state === 'AK') this.getXYForCityAK(...arguments);
|
if (state === 'AK') this.getXYForCityAK(...arguments);
|
||||||
if (state === 'HI') this.getXYForCityHI(...arguments);
|
if (state === 'HI') this.getXYForCityHI(...arguments);
|
||||||
let x = (City.Longitude - MinLongitude) * 57;
|
let x = (City.lon - MinLongitude) * 57;
|
||||||
let y = (MaxLatitude - City.Latitude) * 70;
|
let y = (MaxLatitude - City.lat) * 70;
|
||||||
|
|
||||||
if (y < 30) y = 30;
|
if (y < 30) y = 30;
|
||||||
if (y > 282) y = 282;
|
if (y > 282) y = 282;
|
||||||
|
@ -307,8 +307,8 @@ class RegionalForecast extends WeatherDisplay {
|
||||||
}
|
}
|
||||||
|
|
||||||
getXYForCityAK (City, MaxLatitude, MinLongitude) {
|
getXYForCityAK (City, MaxLatitude, MinLongitude) {
|
||||||
let x = (City.Longitude - MinLongitude) * 37;
|
let x = (City.lon - MinLongitude) * 37;
|
||||||
let y = (MaxLatitude - City.Latitude) * 70;
|
let y = (MaxLatitude - City.lat) * 70;
|
||||||
|
|
||||||
if (y < 30) y = 30;
|
if (y < 30) y = 30;
|
||||||
if (y > 282) y = 282;
|
if (y > 282) y = 282;
|
||||||
|
@ -319,8 +319,8 @@ class RegionalForecast extends WeatherDisplay {
|
||||||
}
|
}
|
||||||
|
|
||||||
getXYForCityHI (City, MaxLatitude, MinLongitude) {
|
getXYForCityHI (City, MaxLatitude, MinLongitude) {
|
||||||
let x = (City.Longitude - MinLongitude) * 57;
|
let x = (City.lon - MinLongitude) * 57;
|
||||||
let y = (MaxLatitude - City.Latitude) * 70;
|
let y = (MaxLatitude - City.lat) * 70;
|
||||||
|
|
||||||
if (y < 30) y = 30;
|
if (y < 30) y = 30;
|
||||||
if (y > 282) y = 282;
|
if (y > 282) y = 282;
|
||||||
|
@ -331,6 +331,11 @@ class RegionalForecast extends WeatherDisplay {
|
||||||
return { x, y };
|
return { x, y };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// to fit on the map, remove anything after punctuation and then limit to 15 characters
|
||||||
|
formatCity(city) {
|
||||||
|
return city.match(/[^-;/\\,]*/)[0].substr(0,12)
|
||||||
|
}
|
||||||
|
|
||||||
async drawCanvas() {
|
async drawCanvas() {
|
||||||
super.drawCanvas();
|
super.drawCanvas();
|
||||||
// break up data into useful values
|
// break up data into useful values
|
||||||
|
|
Loading…
Reference in a new issue