Opened 7 years ago
Closed 2 years ago
#4051 closed defect (fixed)
Strange result with raster ST_Intersects
Reported by: | stev00 | Owned by: | dustymugs |
---|---|---|---|
Priority: | medium | Milestone: | PostGIS 3.4.0 |
Component: | raster | Version: | 2.4.x |
Keywords: | Cc: |
Description
I have odd behaviour when trying to use the ST_Intersects function with rasters, which I am using to filter raster tiles using an index for an ST_Value call.
On both Linux Red Hat (RDS) and Windows using Postgres 10.1 and Postgis 2.4 I get a null result for the filter call for a very small number of point geometries (in fact only one so far from around 1000 points). The only significant feature is that the x value of this point is a whole integer.
I am attaching a full sql file to reproduce a minimal version of the problem. If you look at the rasters in QGIS you should be able to see it covers the point, and adding a very small increment or decrement to the X value means a value is returned (but no difference with y value).
This combined with the whole number issue above means I wonder if it is something to do with the integer value.
I will continue looking into this, and it could obviously be a dependent library issue, but would be interested to see if others can reproduce it.
Attachments (1)
Change History (15)
by , 7 years ago
Attachment: | raster_intersects_potential_bug.sql added |
---|
comment:1 by , 7 years ago
Component: | postgis → raster |
---|---|
Owner: | changed from | to
comment:2 by , 7 years ago
I have done some more tests with the above data. The SQL commands run and results are shown below. I guess this is related to precision - it seems that ST_Worldtorastercoord gives different results to ST_Rastertoworldcoord. Will try and do a bit more digging.
with r as( SELECT * from test_raster WHERE rast && ST_SetSRID(ST_GeomFromText('POINT(529004 182915.87)'),27700) AND fn_st_intersects_log(rast, ST_SetSRID(ST_GeomFromText('POINT(529004 182915.87)'),27700), 1) ) -- result columnx=51, rowy=26 select (ST_worldtorastercoord(rast, 529004, 182915.87)).* from r --result st_rastertoworldcoordx=529003.000000106 st_width=50 st_height=56 st_pixelwidth=1.00000000000698 select ST_RasterToWorldCoordX(rast, 50),st_width(rast), st_height(rast), ST_PixelWidth(rast) from r
comment:3 by , 7 years ago
Milestone: | PostGIS 2.4.4 → PostGIS 2.2.8 |
---|
As much as I'd like to fix this for 2.4.4, I don't have enough time to investigate the issue before release or even if there is one.
I did do enough to determine that yes I got no ST_Value answer back for the ones you say don't work , but haven't confirmed if that's an issue or not or just there is no value for that part.
If it's an issue it's an issue in 2.2 as well so pushing to 2.2
comment:6 by , 5 years ago
Milestone: | PostGIS 2.3.10 → PostGIS 2.5.4 |
---|
comment:7 by , 5 years ago
Milestone: | PostGIS 2.5.4 → PostGIS 2.5.5 |
---|
comment:8 by , 4 years ago
Milestone: | PostGIS 2.5.5 → PostGIS 3.0.3 |
---|
comment:9 by , 4 years ago
Milestone: | PostGIS 3.0.3 → PostGIS 3.0.4 |
---|
comment:10 by , 3 years ago
Milestone: | PostGIS 3.0.4 → PostGIS 2.4.10 |
---|
comment:11 by , 3 years ago
Milestone: | PostGIS 2.4.10 → PostGIS 3.3.0 |
---|
comment:12 by , 2 years ago
Milestone: | PostGIS 3.3.0 → PostGIS 3.4.0 |
---|
comment:13 by , 2 years ago
I tested this today with Postgres 14, Postgis 3.3 and GDAL 3.6dev. I could not reproduce this so I think this bug can be closed out - probably something to do with GDAL I expect
comment:14 by , 2 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
minimally reproduce potential bug