Opened 14 years ago

Last modified 14 years ago

#348 closed defect

[wktraster] st_raster_envelope & st_raster_to_box2d return different results — at Version 3

Reported by: pracine Owned by: pracine
Priority: high Milestone: WKTRaster 0.1.6
Component: raster Version: master
Keywords: Cc:

Description (last modified by pracine)

SELECT ST_AsText(st_raster_envelope(rast)) FROM mytable
UNION ALL
SELECT ST_AsText(st_raster_to_box2d(rast)) FROM mytable

should return two identical lines.

Change History (3)

comment:1 by mloskot, 14 years ago

The difference (WKT Raster Windows build by Regina from 2009-08-10 17:41:12) is as follows:

  • SELECT ST_AsText(st_raster_envelope(rast)) FROM mytable
    POLYGON((-90 90,-72 90,-72 72,-90 72,-90 90))
    
  • SELECT ST_AsText(st_raster_to_box2d(rast)) FROM mytable
    POLYGON((-90 72,-90 90,-72 90,-72 72,-90 72))
    

The two geometries are almost identical. The only difference is which is the first vertex, upper left vs lower left corner.

What does the "should return two identical lines" mean? Which line is the one that should be returned?

comment:2 by pracine, 14 years ago

Status: newassigned

comment:3 by pracine, 14 years ago

Description: modified (diff)

Reformated the query to make the two lines evident.

This bug appears when the coordinates of the center upper left pixel are very precises i.e. -85.750000033333492

A first problem is that the order is different.

A second problem is that the numbers are also different when the precision is high. I guess this problem is related to the fact that bbox are stored as float4s in PostGIS and our version of ST_Envelope returns the float8s version. I think we should return the float4s bbox. I have to test further though.

Note: See TracTickets for help on using tickets.