Skip to content

Commit

Permalink
Avoiding division by zero in coverage computation
Browse files Browse the repository at this point in the history
  • Loading branch information
rahulpratapm committed Jan 27, 2014
1 parent 6c756a5 commit c6b23ab
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions server/src/main/scala/ReverseGeocoderImpl.scala
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,11 @@ class ReverseGeocoderHelperImpl(
val overlapArea = computeOverlapArea(cellGeoms, geom)
val requestArea = geom.getArea()

parse.scoringFeatures.percentOfRequestCovered(math.min(1, overlapArea / requestArea))
parse.scoringFeatures.percentOfFeatureCovered(math.min(1, overlapArea / totalArea))
// coverage is undefined when the request is a point
if (requestArea > 0) {
parse.scoringFeatures.percentOfRequestCovered(math.min(1, overlapArea / requestArea))
parse.scoringFeatures.percentOfFeatureCovered(math.min(1, overlapArea / totalArea))
}
}
}
}
Expand Down

0 comments on commit c6b23ab

Please sign in to comment.