<div dir="ltr"><span style="font-size:12.8px">Greetings,</span><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">I use ST_Tile and ST_CreateOverview to generate tiles from a large source raster to be displayed as a TileXYZ layer in Openlayers (think WMS). For that, it is is necessary to know the column and row index of each tile, so the browser can request the correct tile by index.</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">What is the best way to get these indices, as neither ST_Tile nor ST_CreateOverview seem to generate them by default.</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">My current workaround is to use this query for each table:</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"><div>ALTER TABLE o_22_i3_tiles ADD COLUMN rowid integer, ADD COLUMN colid integer;</div><div><div>UPDATE o_22_i3_tiles_schiller SET</div><div><span style="white-space:pre-wrap">   </span>rowid = sub.rowid,</div><div>    colid = sub.colid </div><div>FROM (</div><div>    SELECT</div><div>        ctid,</div><div>        dense_rank() over (order by round(cast(ST_<wbr>RasterToWorldCoordX(rast, 1, 1) as numeric), 5))-1 as colid,</div><div>        dense_rank() over (order by round(cast(ST_<wbr>RasterToWorldCoordY(rast, 1, 1) as numeric), 5))-1 as rowid</div><div>    FROM o_22_i3_tiles_schiller</div><div>) sub</div><div>WHERE o_22_i3_tiles_schiller.ctid = sub.ctid</div></div></div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">Which is not overly efficient. Is there a smarter way to do this?</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">best regards</div><div style="font-size:12.8px">Tassilo</div></div>