Movatterモバイル変換


[0]ホーム

URL:


Map(options, options.container)

Creates a map instance.

parametertypedescription
optionsObject
options.containerString

HTML element to initialize the map in (or element id as string)

zoomTo(zoom, animOptions)

Zooms to a certain zoom level with easing.

parametertypedescription
zoomNumber
animOptions

Returns

this

zoomOut(animOptions)

Zoom out by 1 level

parametertypedescription
animOptions

Returns

this

zoomIn(animOptions)

Zoom in by 1 level

parametertypedescription
animOptions

Returns

this

update(updateStyle)

Update this map's style and re-render the map.

parametertypedescription
updateStyleObject

new style

Returns

Map :

this

stop

Stop current animation

Returns

this

setView(center, zoom, bearing, pitch)

Sets a map position

parametertypedescription
centerArray

Latitude and longitude (passed as[lat, lng])

zoomnumber

Map zoom level

bearingnumber

Map rotation bearing in degrees counter-clockwise from north

pitchnumber

The angle at which the camera is looking at the ground

Returns

Map :

this

setZoom(zoom)

Sets a map zoom

parametertypedescription
zoomnumber

Map zoom level

Returns

Map :

this

unproject(point)

Get geographical coordinates given pixel coordinates

parametertypedescription
pointArray<number>

[x, y] pixel coordinates

Returns

LatLng

setLayoutProperty(layer, name, value)

Set the value of a layout property in a given style layer.

parametertypedescription
layerstring

ID of a layer

namestring

name of a layout property

valueAny

value for the layout propery; must have the type appropriate for the property as defined in theStyle Specification

Returns

Map :

this

setBearing(bearing)

Sets a map rotation

parametertypedescription
bearingnumber

Map rotation bearing in degrees counter-clockwise from north

Returns

Map :

this

setPaintProperty(layer, name, value, [klass])

Set the value of a paint property in a given style layer.

parametertypedescription
layerstring

ID of a layer

namestring

name of a paint property

valueAny

value for the paint propery; must have the type appropriate for the property as defined in theStyle Specification

klass[string]

optional class specifier for the property

Returns

Map :

this

setCenter(center)

Sets a map location

parametertypedescription
centerArray

Latitude and longitude (passed as[lat, lng])

Returns

Map :

this

setFilter(layer, filter)

Set the filter for a given style layer.

parametertypedescription
layerstring

ID of a layer

filterArray

filter specification, as defined in theStyle Specification

Returns

Map :

this

setClasses(klasses, options)

Helper method to add more than one class

parametertypedescription
klassesArray<string>

An array of class names

optionsstyleOptions

Returns

Map :

this

rotateTo(bearing, animOptions)

Rotate bearing by a certain number of degrees with easing

parametertypedescription
bearingNumber
animOptions

Returns

this

setStyle(style)

Replaces the map's style object

parametertypedescription
styleObject

A style object formatted as JSON

Returns

Map :

this

removeSource(id)

Remove an existing source from the map style.

parametertypedescription
idstring

ID of the source to remove

Returns

Map :

this

getSource(id)

Return the style source object with the givenid.

parametertypedescription
idstring

source ID

Returns

Object

project(latlng)

Get pixel coordinates (relative to map container) given a geographical location

parametertypedescription
latlngLatLng

Returns

Object :

x andy coordinates

hasClass(klass)

Check whether a style class is active

parametertypedescription
klassstring

Name of style class

Returns

boolean

removeLayer(id)

Remove the layer with the givenid from the map. Any layers which refer to thespecified layer via aref property are also removed.

parametertypedescription
idstring

Returns

Map :

this

removeClass(klass, options)

Removes a style class from a map

parametertypedescription
klassstring

name of style class

optionsstyleOptions

Returns

Map :

this

getPitch

Get the current angle in degrees

Returns

number

getPaintProperty(layer, name, [klass])

Get the value of a paint property in a given style layer.

parametertypedescription
layerstring

ID of a layer

namestring

name of a paint property

klass[string]

optional class specifier for the property

Returns

Any :

value for the paint propery

getZoom

Get the current zoom

Returns

number

panBy(offset, animOptions)

Pan by a certain number of pixels

parametertypedescription
offsetArray

[x, y]

animOptions

Returns

this

loaded

Is this map fully loaded? If the style isn't loadedor it has a change to the sources or style that isn'tpropagated to its style, return false.

Returns

boolean :

whether the map is loaded

render

Call when a (re-)render of the map is required, e.g. when theuser panned or zoomed,f or new data is available.

Returns

Map :

this

remove

Destroys the map's underlying resources, including web workers.

Returns

Map :

this

panTo(latlng, animOptions)

Pan to a certain location with easing

parametertypedescription
latlngObject

aLatLng object

animOptions

Returns

this

resetNorth(animOptions)

Sets map bearing to 0 (north) with easing

parametertypedescription
animOptions

Returns

this

resize

Detect the map's new width and height and resize it.

Returns

Map :

this

fitBounds(bounds, options)

Zoom to contain certain geographical bounds

parametertypedescription
boundsArray

[[minLat, minLng], [maxLat, maxLng]]

optionsObject

easeTo(latlng, zoom, bearing, pitch, animOptions)

Easing animation to a specified location/zoom/bearing

parametertypedescription
latlngObject

aLatLng object

zoomNumber
bearingNumber
pitchNumber
animOptions

Returns

this

flyTo(latlng, zoom, bearing, options)

Flying animation to a specified location/zoom/bearing with automatic curve

parametertypedescription
latlngObject

aLatLng object

zoomNumber
bearingNumber
optionsObject

getCenter

Get the current view geographical point

Returns

LatLng

getBearing

Get the current bearing in degrees

Returns

number

getClasses

Return an array of the current active style classes

Returns

boolean

getBounds

Get the map's geographical bounds

Returns

LatLngBounds

featuresAt(point, params)

Get all features at a point ([x, y])

parametertypedescription
pointArray<number>

[x, y] pixel coordinates

paramsObject

getFilter(layer)

Get the filter for a given style layer.

parametertypedescription
layerstring

ID of a layer

Returns

Array :

filter specification, as defined in theStyle Specification

getLayoutProperty(layer, name, [klass])

Get the value of a layout property in a given style layer.

parametertypedescription
layerstring

ID of a layer

namestring

name of a layout property

klass[string]

optional class specifier for the property

Returns

Any :

value for the layout propery

getContainer

Get the Map's container as an HTML element

Returns

HTMLElement :

container

getCanvas

Get the Map's canvas as an HTML canvas

Returns

HTMLElement :

canvas

setPitch(pitch)

Sets a map angle

parametertypedescription
pitchnumber

The angle at which the camera is looking at the ground

Returns

Map :

this

addClass(klass, options)

Adds a style class to a map

parametertypedescription
klassstring

name of style class

optionsstyleOptions

Returns

Map :

this

addSource(id, source)

Add a source to the map style.

parametertypedescription
idstring

ID of the source. Must not be used by any existing source.

sourceObject

source specification, following theMapbox GL Style Reference

Returns

Map :

this

addLayer(layer, [before])

Add a layer to the map style. The layer will be inserted before the layer withIDbefore, or appended ifbefore is omitted.

parametertypedescription
layerLayer
before[string]

ID of an existing layer to insert before

Returns

Map :

this

GeoJSONSource

Create a GeoJSON data source instance given an options object

setData(data)

Update source geojson data and rerender map

parametertypedescription
dataObject orString

A GeoJSON data object or URL to it. The latter is preferable in case of large GeoJSON files.

Control

A base class for map-related interface elements.

remove

Remove this control from the map it has been added to.

Returns

Control :

this

addTo(map)

Add this control to the map, returning the control itselffor chaining. This will insert the control's DOM element intothe map's DOM element if the control has aposition specified.

parametertypedescription
mapMap

Returns

Control :

this

Attribution

Creates an attribution control

Examples

map.addControl(new mapboxgl.Attribution());

LatLng(lat, lng)

Create a latitude, longitude object from a given latitude and longitude pair in degrees.

parametertypedescription
latnumber

latitude

lngnumber

longitude

Examples

var latlng =new mapboxgl.LatLng(37.76, -122.44);

wrap

Return a newLatLng object whose longitude is wrapped to the range (-180, 180).

Returns

LatLng :

wrapped LatLng object

convert(input)

Convert an array to aLatLng object, or return an existingLatLng objectunchanged.

parametertypedescription
inputArray<number> orLatLng

input to convert

Returns

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

Returns

Boolean :

Returns true if the object listens to an event of a particular type

once(type, listener)

Call a function once when an event has fired

parametertypedescription
typeString

Event type.

listenerFunction

Function to be called once when the event is fired

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 tofire and additionallytarget andtype properties

parametertypedescription
typeString

Event type

listenerFunction

Function to be called when the event is fired

fire(type)

Fire event of a given string type with the given data object

parametertypedescription
typeString

The event name

LatLngBounds(sw, ne)

Creates a bounding box from the given pair of points. If parameteres are omitted, anull bounding box is created.

parametertypedescription
swLatLng

southwest

neLatLng

northeast

Examples

var sw =new mapboxgl.LatLng(0,0);var ne =new mapboxgl.LatLng(10, -10);var bounds =new mapboxgl.LatLngBounds(sw, ne);

getSouthWest

Get southwest corner

Returns

LatLng :

southwest

getSouth

Get south edge latitude

Returns

number :

south

getNorthEast

Get northeast corner

Returns

LatLng :

northeast

getNorthWest

Get northwest corner

Returns

LatLng :

northwest

getSouthEast

Get southeast corner

Returns

LatLng :

southeast

getWest

Get west edge longitude

Returns

number :

west

extend(obj)

Extend the bounds to include a given LatLng or LatLngBounds.

parametertypedescription
objLatLng orLatLngBounds

object to extend to

Returns

LatLngBounds :

this

getCenter

Get the point equidistant from this box's corners

Returns

LatLng :

centerpoint

getEast

Get east edge longitude

Returns

number :

east

getNorth

Get north edge latitude

Returns

number :

north

VideoSource

Create a Video data source instance given an options object

extend

latY(lat)

latitude to absolute y coord

parametertypedescription
latNumber

supported(options)

Test whether the basic JavaScript and DOM features required for Mapbox GL are present.

parametertypedescription
optionsObject

window

mapboxgl is a A WebGL JavaScript interactive maps library that can renderMapbox vector tiles.

lngX(lon)

lat/lon <-> absolute pixel coords conversion

parametertypedescription
lonNumber


[8]ページ先頭

©2009-2025 Movatter.jp