Comment 2 for bug 838973

Revision history for this message
Mattia Barbon (mattia.barbon) wrote :

It's a floating point rounding problem; putting a breakpoint on the line were it prints the GACK:

(Pdb) self.region.upper_right_corner.longitude
-118.18
(Pdb) self.region.upper_left_corner.longitude
-118.3
# region width
(Pdb) self.region.upper_right_corner.longitude - self.region.upper_left_corner.longitude
0.11999999999999034
# number of columns in the region
(Pdb) (self.region.upper_right_corner.longitude - self.region.upper_left_corner.longitude)/self.cell_size
5.999999999999517
# coordinate of the 6-th column:
(Pdb) self.region.upper_left_corner.longitude + 6 * 0.02
-118.17999999999999

which is slightly more than region right border -> the point is outside the region.

I think the correct solution is applying round_float() to the temporary Point() constructed for bounds checking.

By the way, there are some other shapes objects where round_float() is not used.