ST_BestPyramidLevel

更新时间:
复制 MD 格式

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

ParameterDescription
rastThe raster object. Must have a valid spatial reference system identifier (SRID).
extentThe geographic extent of the viewport in world space, in the format ((minX,minY),(maxX,maxY)).
widthThe width of the viewport, in pixels.
heightThe 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