Returns the optimal pyramid level for rendering a raster at a given viewport resolution.
Syntax
integer ST_BestPyramidLevel(raster rast, Box extent, integer width, integer height);Parameters
| Parameter | Description |
|---|---|
rast | The raster object. Must have a valid spatial reference system identifier (SRID). |
extent | The geographic extent of the viewport in world space, in the format ((minX,minY),(maxX,maxY)). |
width | The width of the viewport, in pixels. |
height | The height of the viewport, in pixels. |
Return value
The pyramid level that best matches the resolution of the specified viewport. Returns an integer.
Usage notes
The raster object must have a valid SRID.
Example
The following example returns the best pyramid level for a viewport that covers the area ((128.0, 30.0),(128.5, 30.5)) at 800×600 pixels:
SELECT ST_BestPyramidLevel(raster_obj, '((128.0, 30.0),(128.5, 30.5))', 800, 600)
FROM raster_table
WHERE id = 10;Output:
st_bestpyramidlevel
---------------------
3该文章对您有帮助吗?