Bing tile functions
The following functions convert between geometries and tiles in the Microsoft Bing maps
tile system
bing_tile(x, y, zoom_level)
Returns a Bing tile object from integer coordinates x
and
y
and the specified zoom level. The zoom level must be an integer
from 1 through 23. Example:
SELECT bing_tile(10, 20, 12)
bing_tile(quadKey)
Returns a Bing tile object from a quadkey. Example:
SELECT bing_tile(bing_tile_quadkey(bing_tile(10, 20, 12)))
bing_tile_at(latitude, longitude, zoom_level)
Returns a Bing tile object at the specified latitude, longitude, and zoom level.
The latitude must be between -85.05112878 and 85.05112878. The longitude must be
between -180 and 180. The latitude
and longitude
values
must be double
and zoom_level
an integer. Example:
SELECT bing_tile_at(37.431944, -122.166111, 12)
bing_tiles_around(latitude, longitude, zoom_level)
Returns an array of Bing tiles that surround the specified latitude and longitude point at the specified zoom level. Example:
SELECT bing_tiles_around(47.265511, -122.465691, 14)
bing_tiles_around(latitude, longitude, zoom_level, radius_in_km)
Returns, at the specified zoom level, an array of Bing tiles. The array contains
the minimum set of Bing tiles that covers a circle of the specified radius in
kilometers around the specified latitude and longitude. The latitude
,
longitude
, and radius_in_km
values are
double
; the zoom level is an integer
. Example:
SELECT bing_tiles_around(37.8475, 112.596667, 10, .5)
bing_tile_coordinates(tile)
Returns the x
and y
coordinates of the specified Bing
tile. Example:
SELECT bing_tile_coordinates(bing_tile_at(37.431944, -122.166111, 12))
bing_tile_polygon(tile)
Returns the polygon representation of the specified Bing tile. Example:
SELECT bing_tile_polygon(bing_tile_at(47.265511, -122.465691, 4))
bing_tile_quadkey(tile)
Returns the quadkey of the specified Bing tile. Example:
SELECT bing_tile_quadkey(bing_tile(52, 143, 10))
bing_tile_zoom_level(tile)
Returns the zoom level of the specified Bing tile as an integer. Example:
SELECT bing_tile_zoom_level(bing_tile(52, 143, 10))
geometry_to_bing_tiles(geometry, zoom_level)
Returns the minimum set of Bing tiles that fully covers the specified geometry at the specified zoom level. Zoom levels from 1 to 23 are supported. Example:
SELECT geometry_to_bing_tiles(ST_Point(61.56, 58.54), 10)