-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.js
35 lines (28 loc) · 1 KB
/
index.js
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
33
34
35
'use strict';
const _ = require('lodash');
const Promise = require('bluebird');
const csvTerryt = csv(config.csvConverter);
const csvAddress = csv(config.csvConverter);
const csv = require('csvtojson');
const config = require('./config');
global.header = null;
global.terryt = [];
global.addressDict = {};
csvTerryt.fromFile('terryt.csv')
.on('json', jsonObj => global.terryt.push(jsonObj))
.on('done', () => console.log('terryt file loaded', global.terryt.length));
csvAddress.fromFile('addressDict.csv')
.on('json', jsonObj => {
_.set(global,
'addressDict.' +
_.get(jsonObj, 'TYP_CIAGU_KOMUNIKACYJNEGO') + '.' +
_.get(jsonObj, 'ULICA') + '.' +
_.get(jsonObj, 'ADR_NR').toString(),
{
addr: _.get(jsonObj, 'ADR_NR'),
x: _.get(jsonObj, 'GEOM_X'),
y: _.get(jsonObj, 'GEOM_Y')
});
})
.on('done', () => console.log('address dictionary loaded'));
require('./app.js')(config);