Skip to content
Snippets Groups Projects
Commit 0ebb468a authored by Christopher Schankula's avatar Christopher Schankula :earth_africa:
Browse files

final draft of working clustering on the website!

parent eb6f24c0
No related branches found
No related tags found
No related merge requests found
......@@ -18,7 +18,7 @@ public class RecordCluster {
public void addRecord(Record r) {
records.add(r);
individualCount++;
individualCount+=r.getCount();
}
public Iterable<Record> records(){
......@@ -30,7 +30,7 @@ public class RecordCluster {
}
public int getCount() {
return records.size();
return individualCount;
}
public Point centroid() {
......
......@@ -23,9 +23,9 @@ function setCluster(map, lati, longi,n, individualCount) {
var marker = new google.maps.Marker({position: new google.maps.LatLng(lati[i], longi[i]), map: map});
// var content = "point numero" + i;
var content = '<div>' +
'Name:' + name[i] +
'<br>Cluster Count: ' + n[i]+
'<br>Individual Count:' + individualCount[i] + '</div></div>';
'<b>Cluster #</b>' + i +
'<br><b>Record Count</b>: ' + n[i]+
'<br><b>Individual Count</b>: ' + individualCount[i] + '</div></div>';
var infowindow = new google.maps.InfoWindow();
google.maps.event.addListener(marker,'click', (function(marker,content,infowindow){
......@@ -38,7 +38,6 @@ function setCluster(map, lati, longi,n, individualCount) {
infowindow.open(map,marker);
};
})(marker,content,infowindow));
console.log(i);
}
}
......@@ -22,23 +22,27 @@
JSONObject js = new JSONObject();
JSONArray longitude = new JSONArray();
JSONArray latitude = new JSONArray();
JSONArray count = new JSONArray();
JSONArray individualCount = new JSONArray();
JSONArray recordCount = new JSONArray();
// Update value of each JSON Object/Array at the same index as the corresponding Record in Result input
for (RecordCluster rc: clusters){
Point centroid = rc.centroid();
longitude.add(centroid.getX());
latitude.add(centroid.getY());
JSONObject dateobj = new JSONObject();
count.add(rc.getCount());
if (rc.N() > 1){
Point centroid = rc.centroid();
longitude.add(centroid.getX());
latitude.add(centroid.getY());
JSONObject dateobj = new JSONObject();
individualCount.add(rc.getCount());
recordCount.add(rc.N());
}
}
// Insert JSON Array and Objects into main Object
js.put("latitude", latitude);
js.put("longitude", longitude);
js.put("n", count);
js.put("individualCount", result.sum());
js.put("n", recordCount);
js.put("individualCount", individualCount);
js.put("time", result.time());
out.print(js.toJSONString());
......
......@@ -37,7 +37,6 @@ function setMarkers(map, lati, longi,name, date, individualCount) {
infowindow.open(map,marker);
};
})(marker,content,infowindow));
console.log(i);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment