Skip to main content

RasterSource

import { RasterSource } from '@rnmapbox/maps';

RasterSource

RasterSource is a map content source that supplies raster image tiles to be shown on the map. The location of and metadata about the tiles are defined either by an option dictionary or by an external file that conforms to the TileJSON specification.

props​

id​

string

A string that uniquely identifies the source.

defaults to: Mapbox.StyleSource.DefaultSourceID

existing​

boolean

The id refers to an existing source in the style. Does not create a new source.

url​

string

A URL to a TileJSON configuration file describing the source’s contents and other metadata.

tileUrlTemplates​

Array

An array of tile URL templates. If multiple endpoints are specified, clients may use any combination of endpoints. Example: https://example.com/raster-tiles/{z}/{x}/{y}.png

minZoomLevel​

number

An unsigned integer that specifies the minimum zoom level at which to display tiles from the source. The value should be between 0 and 22, inclusive, and less than maxZoomLevel, if specified. The default value for this option is 0.

maxZoomLevel​

number

An unsigned integer that specifies the maximum zoom level at which to display tiles from the source. The value should be between 0 and 22, inclusive, and less than minZoomLevel, if specified. The default value for this option is 22.

tileSize​

number

Size of the map tiles. Mapbox urls default to 256, all others default to 512.

prefetchZoomDelta​

number

When greater than 0, the map first requests a tile at a zoom level below zoom - prefetchZoomDelta, rounded to a multiple of the delta, so it can show a low-resolution map quickly. 0 disables this. The default value for this option is 4. Only read when the source is created.

Raster Source tile requests

tileNetworkRequestsDelay​

number

Delay in milliseconds before a tile's network request is sent while a gesture or a camera animation is in progress. Tiles that leave the viewport before the delay elapses are never requested. Has no effect on an idle map. The default value for this option is 0. Only read when the source is created.

Raster Source tile requests

tms​

boolean

Influences the y direction of the tile coordinates. (tms inverts y axis)

attribution​

string

An HTML or literal text string defining the buttons to be displayed in an action sheet when the source is part of a map view’s style and the map view’s attribution button is pressed.

children​

React.ReactElement | React.ReactElement[]

FIX ME NO DESCRIPTION

sourceBounds​

Array

An array containing the longitude and latitude of the southwest and northeast corners of the source's bounding box in the following order: [sw.lng, sw.lat, ne.lng, ne.lat]. When this property is included in a source, no tiles outside of the given bounds are requested by Mapbox GL.