GeoJSONSource
A source containing GeoJSON.
(See the Style Specification for detailed documentation of options.)
Constructor
Name | |
---|---|
GeoJSONSource | new GeoJSONSource(id: string, options: GeoJSONSourceOptions, dispatcher: Dispatcher, eventedParent: Evented) Parameters
|
Methods
Method | |
---|---|
abortTile | abortTile(tile: Tile) Parameters
Return Value: void |
fire | fire(event: string | Event, properties: any) Parameters
Return Value: GeoJSONSource |
getClusterChildren | getClusterChildren(clusterId: number, callback: Callback) Parameters
Return Value: GeoJSONSource For clustered sources, fetches the children of the given cluster on the next zoom level (as an array of GeoJSON features). |
getClusterExpansionZoom | getClusterExpansionZoom(clusterId: number, callback: Callback) Parameters
Return Value: GeoJSONSource For clustered sources, fetches the zoom at which the given cluster expands. |
getClusterLeaves | getClusterLeaves(clusterId: number, limit: number, offset: number, callback: Callback) Parameters
Return Value: GeoJSONSource For clustered sources, fetches the original points that belong to the cluster (as an array of GeoJSON features). |
hasTransition | hasTransition() Return Value: boolean |
listens | listens(type: string) Parameters
Return Value: any Returns a true if this instance of Evented or any forwardeed instances of Evented have a listener for the specified type. |
load | load() Return Value: void |
loadTile | loadTile(tile: Tile, callback: Callback) Parameters
Return Value: void |
loaded | loaded() Return Value: boolean |
off | off(type: string, listener: Listener) Parameters
Return Value: GeoJSONSource Removes a previously registered event listener. |
on | on(type: string, listener: Listener) Parameters
Return Value: GeoJSONSource Adds a listener to a specified event type. |
onAdd | onAdd(map: Map) Parameters
Return Value: void |
onRemove | onRemove() Return Value: void |
once | once(type: string, listener: Listener) Parameters
Return Value: GeoJSONSource Adds a listener that will be called only once to a specified event type. The listener will be called first time the event fires after the listener is registered. |
serialize | serialize() Return Value: any |
setData | setData(data: string | GeoJSON) Parameters
Return Value: GeoJSONSource Sets the GeoJSON data and re-renders the map. |
setEventedParent | setEventedParent(parent: Evented, data: any) Parameters
Return Value: GeoJSONSource Bubble all events fired by this instance of Evented to this parent instance of Evented. |
unloadTile | unloadTile(tile: Tile) Parameters
Return Value: void |
Example
ImageSource
A data source containing an image.
(See the Style Specification for detailed documentation of options.)
Constructor
Name | |
---|---|
ImageSource | new ImageSource(id: string, options: CanvasSourceSpecification | ImageSourceSpecification | VideoSourceSpecification, dispatcher: Dispatcher, eventedParent: Evented) Parameters
|
Methods
Method | |
---|---|
fire | fire(event: string | Event, properties: any) Parameters
Return Value: ImageSource |
hasTransition | hasTransition() Return Value: boolean |
listens | listens(type: string) Parameters
Return Value: any Returns a true if this instance of Evented or any forwardeed instances of Evented have a listener for the specified type. |
load | load(newCoordinates: Coordinates, successCallback: Function) Parameters
Return Value: void |
loadTile | loadTile(tile: Tile, callback: Callback) Parameters
Return Value: void |
loaded | loaded() Return Value: boolean |
off | off(type: string, listener: Listener) Parameters
Return Value: ImageSource Removes a previously registered event listener. |
on | on(type: string, listener: Listener) Parameters
Return Value: ImageSource Adds a listener to a specified event type. |
onAdd | onAdd(map: Map) Parameters
Return Value: void |
once | once(type: string, listener: Listener) Parameters
Return Value: ImageSource Adds a listener that will be called only once to a specified event type. The listener will be called first time the event fires after the listener is registered. |
prepare | prepare() Return Value: void |
serialize | serialize() Return Value: any |
setCoordinates | setCoordinates(coordinates: Coordinates) Parameters
Return Value: ImageSource Sets the image's coordinates and re-renders the map. |
setEventedParent | setEventedParent(parent: Evented, data: any) Parameters
Return Value: ImageSource Bubble all events fired by this instance of Evented to this parent instance of Evented. |
updateImage | updateImage(options: { coordinates: Coordinates,url: string }) Parameters
Return Value: ImageSource Updates the image URL and, optionally, the coordinates. To avoid having the image flash after changing, set the raster-fade-duration paint property on the raster layer to 0. |
Example
VideoSource
A data source containing video.
(See the Style Specification for detailed documentation of options.)
Constructor
Name | |
---|---|
VideoSource | new VideoSource(id: string, options: VideoSourceSpecification, dispatcher: Dispatcher, eventedParent: Evented) Parameters
|
Methods
Method | |
---|---|
fire | fire(event: string | Event, properties: any) Parameters
Return Value: VideoSource |
getVideo | getVideo() Return Value: HTMLVideoElement Returns the HTML video element. |
hasTransition | hasTransition() Return Value: boolean |
listens | listens(type: string) Parameters
Return Value: any Returns a true if this instance of Evented or any forwardeed instances of Evented have a listener for the specified type. |
load | load() Return Value: void |
loadTile | loadTile(tile: Tile, callback: Callback) Parameters
Return Value: void |
loaded | loaded() Return Value: boolean |
off | off(type: string, listener: Listener) Parameters
Return Value: VideoSource Removes a previously registered event listener. |
on | on(type: string, listener: Listener) Parameters
Return Value: VideoSource Adds a listener to a specified event type. |
onAdd | onAdd(map: Map) Parameters
Return Value: void |
once | once(type: string, listener: Listener) Parameters
Return Value: VideoSource Adds a listener that will be called only once to a specified event type. The listener will be called first time the event fires after the listener is registered. |
pause | pause() Return Value: void Pauses the video. |
play | play() Return Value: void Plays the video. |
prepare | prepare() Return Value: void Sets the video's coordinates and re-renders the map. |
seek | seek(seconds: number) Parameters
Return Value: void Sets playback to a timestamp, in seconds. |
serialize | serialize() Return Value: none |
setCoordinates | setCoordinates(coordinates: Coordinates) Parameters
Return Value: VideoSource Sets the image's coordinates and re-renders the map. |
setEventedParent | setEventedParent(parent: Evented, data: any) Parameters
Return Value: VideoSource Bubble all events fired by this instance of Evented to this parent instance of Evented. |
updateImage | updateImage(options: { coordinates: Coordinates,url: string }) Parameters
Return Value: VideoSource Updates the image URL and, optionally, the coordinates. To avoid having the image flash after changing, set the raster-fade-duration paint property on the raster layer to 0. |
Example
CanvasSource
A data source containing the contents of an HTML canvas. See CanvasSourceOptions for detailed documentation of options.
Constructor
Name | |
---|---|
CanvasSource | new CanvasSource(id: string, options: CanvasSourceSpecification, dispatcher: Dispatcher, eventedParent: Evented) Parameters
|
Methods
Method | |
---|---|
fire | fire(event: string | Event, properties: any) Parameters
Return Value: CanvasSource |
getCanvas | getCanvas() Return Value: HTMLCanvasElement Returns the HTML canvas element. |
hasTransition | hasTransition() Return Value: boolean |
listens | listens(type: string) Parameters
Return Value: any Returns a true if this instance of Evented or any forwardeed instances of Evented have a listener for the specified type. |
load | load() Return Value: void Disables animation. The map will display a static copy of the canvas image. |
loadTile | loadTile(tile: Tile, callback: Callback) Parameters
Return Value: void |
loaded | loaded() Return Value: boolean |
off | off(type: string, listener: Listener) Parameters
Return Value: CanvasSource Removes a previously registered event listener. |
on | on(type: string, listener: Listener) Parameters
Return Value: CanvasSource Adds a listener to a specified event type. |
onAdd | onAdd(map: Map) Parameters
Return Value: void |
onRemove | onRemove() Return Value: void |
once | once(type: string, listener: Listener) Parameters
Return Value: CanvasSource Adds a listener that will be called only once to a specified event type. The listener will be called first time the event fires after the listener is registered. |
prepare | prepare() Return Value: void |
serialize | serialize() Return Value: any |
setCoordinates | setCoordinates(coordinates: Coordinates) Parameters
Return Value: CanvasSource Sets the image's coordinates and re-renders the map. |
setEventedParent | setEventedParent(parent: Evented, data: any) Parameters
Return Value: CanvasSource Bubble all events fired by this instance of Evented to this parent instance of Evented. |
updateImage | updateImage(options: { coordinates: Coordinates,url: string }) Parameters
Return Value: CanvasSource Updates the image URL and, optionally, the coordinates. To avoid having the image flash after changing, set the raster-fade-duration paint property on the raster layer to 0. |