Map(options, options.container)
Creates a map instance.
stop
Stop current animation
Returnsthis
project(latlng)
Get pixel coordinates (relative to map container) given a geographical location
ReturnsObject
:
x
and y
coordinates
removeLayer(id)
Remove the layer with the given id
from the map. Any layers which refer to the specified layer via a ref
property are also removed.
Map
:
this
loaded
Is this map fully loaded? If the style isn't loaded or it has a change to the sources or style that isn't propagated to its style, return false.
Returnsboolean
:
whether the map is loaded
render
Call when a (re-)render of the map is required, e.g. when the user panned or zoomed,f or new data is available.
ReturnsMap
:
this
remove
Destroys the map's underlying resources, including web workers.
ReturnsMap
:
this
resize
Detect the map's new width and height and resize it.
ReturnsMap
:
this
getContainer
Get the Map's container as an HTML element
ReturnsHTMLElement
:
container
getCanvas
Get the Map's canvas as an HTML canvas
ReturnsHTMLElement
:
canvas
addLayer(layer, [before])
Add a layer to the map style. The layer will be inserted before the layer with ID before
, or appended if before
is omitted.
Map
:
this
GeoJSONSource
Create a GeoJSON data source instance given an options object
Navigation
Creates a navigation control with zoom buttons and a compass
Control
A base class for map-related interface elements.
remove
Remove this control from the map it has been added to.
ReturnsControl
:
this
addTo(map)
Add this control to the map, returning the control itself for chaining. This will insert the control's DOM element into the map's DOM element if the control has a position
specified.
Control
:
this
Attribution
Creates an attribution control
Examplesmap.addControl(new mapboxgl.Attribution());
LatLng(lat, lng)
Create a latitude, longitude object from a given latitude and longitude pair in degrees.
Examplesvar latlng = new mapboxgl.LatLng(37.76, -122.44);
wrap
Return a new LatLng
object whose longitude is wrapped to the range (-180, 180).
LatLng
:
wrapped LatLng object
convert(input)
Convert an array to a LatLng
object, or return an existing LatLng
object unchanged.
LatLng
:
LatLng object or original input
Evented
Methods mixed in to other classes for event capabilities.
listens
Check if an event is registered to a type
ReturnsBoolean
:
Returns true if the object listens to an event of a particular type
off
Remove a event listener
on(type, listener)
Subscribe to a specified event with a listener function the latter gets the data object that was passed to fire
and additionally target
and type
properties
fire(type)
Fire event of a given string type with the given data object
LatLngBounds(sw, ne)
Creates a bounding box from the given pair of points. If parameteres are omitted, a null
bounding box is created.
var sw = new mapboxgl.LatLng(0, 0); var ne = new mapboxgl.LatLng(10, -10); var bounds = new mapboxgl.LatLngBounds(sw, ne);
getCenter
Get the point equidistant from this box's corners
ReturnsLatLng
:
centerpoint
VideoSource
Create a Video data source instance given an options object
extend
latY(lat)
latitude to absolute y coord
supported(options)
Test whether the basic JavaScript and DOM features required for Mapbox GL are present.
window
mapboxgl is a A WebGL JavaScript interactive maps library that can render Mapbox vector tiles.
lngX(lon)
lat/lon <-> absolute pixel coords conversion
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4