Opened 2 years ago

Last modified 2 years ago

#5228 new defect

ST_MakeEmptyCoverage creates a bad tiling

Reported by: arthurbazin Owned by: robe
Priority: medium Milestone:
Component: raster Version: 3.2.x
Keywords: Cc:

Description

When using ST_MakeEmptyCoverage the behaviour is really unexpected.

When reading the documentation, I understand that if we provide a width/height and a tilewidth/tileheight, It create a set of tile with the same size (except for the tile on the border left and bottom) that fullfill the width/height.

But when I'm using this function, I have tiles with different sizes wich follow an interesting pattern.

Try with this request :

SELECT
  ST_Envelope(
	ST_MakeEmptyCoverage( 
	  1,  -- Tilewidth
	  1,  -- Tileheight
	  4,  -- Coverage width
	  4,  -- Coverage height
	  0,    -- X origin
	  0,    -- Y origin 
	  1,    -- Scale X
	  1,    -- Scale Y 
	  0,    -- Skew X
	  0,    -- Skew Y 
	  4326  -- SRID
	)
  )

The result have 16 tiles :

The 1st 4 tiles have the height of the coverage

The 2nd 4 tiles have an height of coverageheight - 1*tilewidth

The 3rd 4 tiles have an height of coverageheight - 2*tilewidth

The 4th 4 tiles have an height of coverageheight - 3*tilewidth

Maybe I don't understand how this function works but my expected result would be the result of this request :

SELECT
  ST_Envelope(
    ST_Tile(
      ST_MakeEmptyRaster( 
        4,  -- Coverage width
        4,  -- Coverage height
        0,    -- X origin
        0,    -- Y origin 
        1,    -- Scale X
        1,    -- Scale Y 
        0,    -- Skew X
        0,    -- Skew Y 
        4326  -- SRID
        ),
      1,
      1
    )
  )  

Change History (2)

comment:1 by arthurbazin, 2 years ago

My full version of postgis : POSTGIS="3.2.1 3.2.1" [EXTENSION] PGSQL="130" GEOS="3.10.2-CAPI-1.16.0" PROJ="7.2.1" GDAL="GDAL 3.4.2, released 2022/03/08 GDAL_DATA not found" LIBXML="2.9.9" LIBJSON="0.12" LIBPROTOBUF="1.2.1" WAGYU="0.5.0 (Internal)" RASTER

comment:2 by robe, 2 years ago

Component: postgisraster
Owner: changed from pramsey to robe
Note: See TracTickets for help on using tickets.