ST_BestPyramidLevel

更新时间:
复制 MD 格式

Computes the optimal pyramid level for rendering a raster object within a viewport, based on the viewport's spatial extent and pixel dimensions.

Syntax

integer ST_BestPyramidLevel(raster rast, Box extent, integer width, integer height);

Parameters

ParameterTypeDescription
rastrasterThe raster object.
extentBoxThe world space of the viewport, in the format ((minX,minY),(maxX,maxY)).
widthintegerThe width of the viewport, in pixels.
heightintegerThe height of the viewport, in pixels.

Usage notes

The raster object must have a valid spatial reference system identifier (SRID).

Examples

Retrieve the best pyramid level for a viewport that spans from (128.0, 30.0) to (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;

Result:

3