Skip to content

Commit

Permalink
fixing empty point by avoiding the scenario wher it could happen
Browse files Browse the repository at this point in the history
  • Loading branch information
DiaZork committed Jan 29, 2025
1 parent d998f86 commit 8fa2fa8
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/main/java/eu/ec/doris/kohesio/controller/MapController.java
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,15 @@ private ResponseEntity<JSONObject> handleBoundingBox(
country,
180
);
return createResponse(tmp, search, language, granularityRegion, timeout);
// to avoid single point cluster on high level that would make the point API failed
int total = 0;
for (Entry<String, Zone> entry : tmp.entrySet()) {
Zone zone = entry.getValue();
total += zone.getNumberProjects();
}
if (total < 2000) {
return createResponse(tmp, search, language, granularityRegion, timeout);
}
}
// in this case create the clusters by taking all points
List<Feature> features = getProjectsPoints(
Expand Down

0 comments on commit 8fa2fa8

Please sign in to comment.