Skip to content

Commit

Permalink
Merge pull request #878 from AtlasOfLivingAustralia/876-return-zero-bbox
Browse files Browse the repository at this point in the history
#876 return 0's bbox when no records
  • Loading branch information
adam-collins authored Mar 28, 2024
2 parents 53edbae + ceeca21 commit c960c4b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/main/java/au/org/ala/biocache/dao/SearchDAOImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -2266,7 +2266,12 @@ public double[] getBBox(SpatialSearchRequestDTO requestParams) throws Exception

SimpleOrderedMap facets = SearchUtils.getMap(qr.getResponse(), "facets");

return new double[]{toDouble(facets.get("x1")), toDouble(facets.get("y1")), toDouble(facets.get("x2")), toDouble(facets.get("y2"))};
try {
return new double[]{toDouble(facets.get("x1")), toDouble(facets.get("y1")), toDouble(facets.get("x2")), toDouble(facets.get("y2"))};
} catch (Exception ignored) {
// Might be a query without one of decimalLongitude or decimalLatitude, e.g. no records found
return new double[]{0, 0, 0, 0};
}
}

/**
Expand Down

0 comments on commit c960c4b

Please sign in to comment.