-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathget-us-bounds.js
More file actions
32 lines (27 loc) · 1.02 KB
/
get-us-bounds.js
File metadata and controls
32 lines (27 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
const { readJson } = require('./read-json');
const BoundingBox = require('./bounding-box');
const { makeGeoJsonBoundingBox } = require('./geojson-bounds');
function getUsBounds() {
console.log('Loading geographic extremities to calculate US bounds...')
console.log(' - ME...');
const ME = readJson('./data/me_maine_zip_codes_geo.min.json');
console.log(' - MN...');
const MN = readJson('./data/mn_minnesota_zip_codes_geo.min.json');
console.log(' - FL...');
const FL = readJson('./data/fl_florida_zip_codes_geo.min.json');
console.log(' - WA...');
const WA = readJson('./data/wa_washington_zip_codes_geo.min.json');
console.log(' - TX...');
const TX = readJson('./data/tx_texas_zip_codes_geo.min.json');
const boxes = [
makeGeoJsonBoundingBox(ME),
makeGeoJsonBoundingBox(MN),
makeGeoJsonBoundingBox(FL),
makeGeoJsonBoundingBox(WA),
makeGeoJsonBoundingBox(TX),
];
return boxes.reduce((bigBox, box) => bigBox.growToBox(box), new BoundingBox());
}
module.exports = {
getUsBounds,
};