-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathanalysis.js
More file actions
86 lines (71 loc) · 3.02 KB
/
analysis.js
File metadata and controls
86 lines (71 loc) · 3.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
const query = require('./query');
function getCrimeAmountWithinRange(lowLat,highLat,lowLong,highLong,callback) {
// query.queryData(`
// SELECT address_cords.address, address_cords.latitude, address_cords.longitude, raw_crime.crime
// FROM raw_crime
// INNER JOIN address_cords
// ON address_cords.address = raw_crime.address
// AND address_cords.latitude > ${lowLat} AND address_cords.latitude < ${highLat} AND ABS(address_cords.longitude) > ${highLong} AND ABS(address_cords.longitude) < ${lowLong}
// `)
}
function getBusinessesInRegion(lowLat,highLat,lowLong,highLong,callback) {
}
function getCrimeAmountWithinRangeWithinYear(lowLat,highLat,lowLong,highLong,callback) {
}
function getTotalCrimeAmountByYear(year,callback) {
}
function getCrimeChartData() {
return([53917,53017,52713,55757]);
}
function getCoordinatesForZone(zone,callback) {
query.queryData(`
SELECT address_cords.address, address_cords.latitude, address_cords.longitude, raw_land_use.use14_label
FROM raw_land_use
INNER JOIN address_cords
ON address_cords.address = CONCAT(CAST(raw_land_use.stnumber AS VARCHAR), ' ', raw_land_use.full_stname)
AND raw_land_use.use14_label = '${zone}'
LIMIT 200;
`,function(err,results) {
var coordinateData = [];
results.shift();
results.forEach(function(result) {
var coordinate = {
lat: result.Data[1].VarCharValue,
long: result.Data[2].VarCharValue,
}
coordinateData.push(coordinate);
})
callback(err,coordinateData);
});
}
function getCoordinatesForCrimes(callback) {
query.queryData(`
SELECT address_cords.address, address_cords.latitude, address_cords.longitude, raw_crime.crime
FROM raw_crime
INNER JOIN address_cords
ON address_cords.address = raw_crime.address
`,function(err,results) {
var coordinateData = [];
results.shift();
results.forEach(function(result) {
var coordinate = {
lat: result.Data[1].VarCharValue,
long: result.Data[2].VarCharValue,
}
coordinateData.push(coordinate);
})
callback(err,coordinateData);
});
}
function getCrimeLatLongWithinRange(lowLat,highLat,lowLong,highLong,callback) {
}
function getCrimeLatLongWithinRangeWithinYear(lowLat,highLat,lowLong,highLon,callback) {
}
module.exports.getCrimeAmountWithinRange = getCrimeAmountWithinRange;
module.exports.getCrimeAmountWithinRangeWithinYear = getCrimeAmountWithinRangeWithinYear;
module.exports.getTotalCrimeAmountByYear = getTotalCrimeAmountByYear;
module.exports.getCrimeChartData = getCrimeChartData;
module.exports.getCrimeLatLongWithinRange = getCrimeLatLongWithinRange;
module.exports.getCrimeLatLongWithinRangeWithinYear = getCrimeAmountWithinRangeWithinYear;
module.exports.getCoordinatesForZone = getCoordinatesForZone;
module.exports.getCoordinatesForCrimes = getCoordinatesForCrimes;