Skip to content

Commit

Permalink
Fix circles crash by only showing nearby circles (Path-Check#212)
Browse files Browse the repository at this point in the history
  • Loading branch information
tremblerz authored and jgrainger-745 committed Apr 1, 2020
1 parent fb9a117 commit 607faf7
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions app/views/Overlap.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,6 @@ class OverlapScreen extends Component {
const lat = parseFloat(row[7]);
const long = parseFloat(row[8]);
if (!isNaN(lat) && !isNaN(long)) {
// Threshold for using only points in 4k
// if (distance(latestLat, latestLong, lat, long) < 4000) {
if (true) {
var key = String(lat) + '|' + String(long);
if (!(key in parsedRows)) {
Expand All @@ -246,11 +244,15 @@ class OverlapScreen extends Component {
plotCircles = async records => {
try {
var circles = [];
const dist_threshold = 2000; //In KMs
const latestLat = this.state.initialRegion.latitude;
const latestLong = this.state.initialRegion.longitude;
for (const key in records) {
const latitude = parseFloat(key.split('|')[0]);
const longitude = parseFloat(key.split('|')[1]);
const count = records[key];
if (!isNaN(latitude) && !isNaN(longitude)) {
if (!isNaN(latitude) && !isNaN(longitude) &&
distance(latestLat, latestLong, latitude, longitude) < dist_threshold) {
var circle = {
center: {
latitude: latitude,
Expand All @@ -259,9 +261,10 @@ class OverlapScreen extends Component {
radius: 50 * count,
};
circles.push(circle);
console.log(count);
}
console.log(count);
}
console.log(circles.length, "points found");
this.setState({
circles: circles,
});
Expand Down

0 comments on commit 607faf7

Please sign in to comment.