Opened 11 years ago
Closed 10 years ago
#2605 closed defect (fixed)
armel: _ST_Covers() returns true for point in hole
Reported by: | mwanner | Owned by: | pramsey |
---|---|---|---|
Priority: | medium | Milestone: | PostGIS 2.1.4 |
Component: | postgis | Version: | 2.1.x |
Keywords: | Cc: |
Description
I tracked down an issue in the topology test suite (test addpolygon) to the following (on ARM, little-endian):
test=# SELECT _ST_Covers('POLYGON((9 28, 16 29, 16 23, 10 23, 9 28), (15 25, 13 27, 11 24, 15 25))'::geometry, 'POINT(13 25)'::geometry); _st_covers ------------ t (1 row)
The point in question in excluded by the hole, so _ST_Covers() should return false. It works properly if you use a small polygon, instead:
test=# SELECT _ST_Covers('POLYGON((9 28, 16 29, 16 23, 10 23, 9 28), (15 25, 13 27, 11 24, 15 25))'::geometry, 'POLYGON((13 25, 13.1 25, 13 25.1, 13 25))'::geometry); _st_covers ------------ f (1 row)
Attachments (1)
Change History (6)
comment:1 by , 11 years ago
comment:2 by , 11 years ago
An 'int' return value gets casted to 'char' in several places. The latter isn't necessarily signed, so a '(int) -1' value may well be converted to a positive 'char' value on architectures where 'char' is unsigned.
The attached patch fixes this issue by clearly separating the 'int' and 'char' (or 'bool') values.
comment:4 by , 11 years ago
Milestone: | PostGIS 2.1.2 → PostGIS 2.1.3 |
---|
comment:5 by , 10 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
The corresponding _ST_CoveredBy() call fails in the same way, which is the reason for test 'tickets' failing on #2084. The following is a simplified version that mistakenly returns true:
However, I guess this runs through the same code path.