Home Reference Source
public class | source

Mapbox

Extends:

Queueable → Mapbox

Member Summary

Public Members
public

maps: {}

public

overlays: {}

public

popup: *

public

queue: *

public

Method Summary

Public Methods
public

addClick(pid: *, json: *)

public

addImages(pid: int, json: object)

Load images for use as icons (needs to be run prior to layer addition)

public

addMap(pid: int, json: object)

Create a new mapbox gl map

public

addPopup(pid: int, json: object)

Add a popup to the map

public

addSelect(pid: int, json: object)

Add a select control to a layer

public

addSource(pid: int, json: object)

Add a new source and layer to the map

public

awaitSourceFeatures(pid: int, json: object)

Await the source to be valid on a layer because mapbox has no event for this WARNING SHIT HACK

public

clearSource(pid: int, json: object)

Set the data for a source

public

getMapDetails(pid: int, json: object)

Set a memory mapDetails to have current info on the state of the map

public

init(queue: *)

public

manualSelect(pid: *, json: *)

public

moveToFeature(pid: int, json: object)

move to a feature

public

moveToLocation(pid: int, json: object)

Move to a lat long

public

paintQueryFeatures(pid: int, json: object)

Query and highlight feature depending on the paint features

public

removeClick(pid: *, json: *)

public

removeEditTools(pid: *, json: *)

public

removePopup(pid: int, json: object)

Remove a popup from the map

public

resize(pid: int, json: object)

Resize the visible map

public

setData(pid: int, json: object)

Set the data for a layer

public

setFilter(pid: int, json: object)

Set filter on a layer

public

setLayoutProperty(pid: *, json: *)

public

setPaintProperty(pid: *, json: *)

public

setPitch(pid: int, json: object)

Set pitch of the visible map

public

zoomIn(pid: int, json: object)

Zoom in the map

public

zoomOut(pid: int, json: object)

Zoom out the map

public

zoomTo(pid: int, json: object)

Zoom the map

public

zoomToBounds(pid: int, json: object)

Zoom to the bounds of a layer

public

zoomToFeature(pid: int, json: object)

Zoom /MapboxGL move to a feature

Private Methods
private

addLayer(options: object)

Add the layer to the map once a source has been created.

Inherited Summary

From class Queueable
public

queue: *

public
public

finished(pid: *, mode: *)

Call this method after you command has finished.

public

init(queue: *)

init, override this for any promise based inits setting the self.ready=true after the promise

public

set(pid: *, value: *)

public

start(pid: *, command: *, json: *)

Called from queue, starts running the actual command

Public Members

public maps: {} source

public overlays: {} source

public popup: * source

public queue: * source

Override:

Queueable#queue

public ready: boolean source

Override:

Queueable#ready

Public Methods

public addClick(pid: *, json: *) source

Params:

NameTypeAttributeDescription
pid *
json *

public addImages(pid: int, json: object) source

Load images for use as icons (needs to be run prior to layer addition)

Params:

NameTypeAttributeDescription
pid int
json object
json.map string

name for the map (used to reference)

json.images object

array of images to load in format [{"url":"url to image ","id":"id to use"}]

public addMap(pid: int, json: object) source

Create a new mapbox gl map

Params:

NameTypeAttributeDescription
pid int
json object
json.map string

name for the map (used to reference)

json.target string

id of element in the page to target

json.style string

mapbox style for the map

json.zoom int

Set the initial zoom of the map

json.maxZoom int

Set the max zoom for the map (default 34)

json.center array

Center on

Example:

mapbox.addMap({"map": "testMap", "target":"mapboxMap", "style": "mapbox://styles/mapbox/streets-v11", "zoom": 8, "center": [-70, 41.2]});

public addPopup(pid: int, json: object) source

Add a popup to the map

Params:

NameTypeAttributeDescription
pid int
json object
json.map string

The map that the querying layer is on

json.lngLat array

The long Lat to place the popup at

json.template string

The template to use

public addSelect(pid: int, json: object) source

Add a select control to a layer

Params:

NameTypeAttributeDescription
pid int
json object
json.map string

name for the map (used to reference)

json.layers string

name for the map layers in []

json.queue object

queue to call upon select

json.unselectQueue object

queue to call upon unselect

public addSource(pid: int, json: object) source

Add a new source and layer to the map

Params:

NameTypeAttributeDescription
pid int
json object
json.map string

name for the map (used to reference)

json.name string

Name for the layer/source

json.type string

The type of feature for the layer one of ['Point', 'Line', 'Polygon', 'MultiLineString']

json.filter string

The layer filter

json.data string | object

Set the data of the source, this could also be a url for the data

Example:

mapbox.addSource({"map": "testMap", "name": "newLayer", "featureType": "Point", "data": "https://d2ad6b4ur7yvpq.cloudfront.net/naturalearth-3.3.0/ne_10m_ports.geojson"});

public awaitSourceFeatures(pid: int, json: object) source

Await the source to be valid on a layer because mapbox has no event for this WARNING SHIT HACK

Params:

NameTypeAttributeDescription
pid int
json object
json.map string

name for the map (used to reference)

json.layer string

name for the map layer

public clearSource(pid: int, json: object) source

Set the data for a source

Params:

NameTypeAttributeDescription
pid int
json object
json.map string

The name of the map that the layer is on

json.name string

The name of the layer to clear

public getMapDetails(pid: int, json: object) source

Set a memory mapDetails to have current info on the state of the map

Params:

NameTypeAttributeDescription
pid int
json object
json.map string

The map that the querying layer is on

public init(queue: *) source

init, override this for any promise based inits setting the self.ready=true after the promise

Override:

Queueable#init

Params:

NameTypeAttributeDescription
queue *

public manualSelect(pid: *, json: *) source

Params:

NameTypeAttributeDescription
pid *
json *

public moveToFeature(pid: int, json: object) source

move to a feature

Params:

NameTypeAttributeDescription
pid int
json object
json.map string

The map that the querying layer is on

json.name string

The name of the layer to query

json.property string

The property key to check against

json.value string

The value of the property that we'll be looking for

public moveToLocation(pid: int, json: object) source

Move to a lat long

Params:

NameTypeAttributeDescription
pid int
json object
json.map string

The map that the querying layer is on

json.coordinates string

lat long in array format

public paintQueryFeatures(pid: int, json: object) source

Query and highlight feature depending on the paint features

Params:

NameTypeAttributeDescription
pid int
json object
json.map string

The map that the querying layer is on

json.name string

The name of the layer to query

json.paint object

The pain object for querying ans styling

json.paint.type string

The styling type that will be changed for highlighting

json.paint.value array

The list of paint styles for querying e.g. [["get", "feature_name"], "test_name", "#333399"] This will be appended to the current style

public removeClick(pid: *, json: *) source

Params:

NameTypeAttributeDescription
pid *
json *

public removeEditTools(pid: *, json: *) source

Params:

NameTypeAttributeDescription
pid *
json *

public removePopup(pid: int, json: object) source

Remove a popup from the map

Params:

NameTypeAttributeDescription
pid int
json object
json.map string

The map that the querying layer is on

public resize(pid: int, json: object) source

Resize the visible map

Params:

NameTypeAttributeDescription
pid int
json object
json.map string

The map that the querying layer is on

public setData(pid: int, json: object) source

Set the data for a layer

Params:

NameTypeAttributeDescription
pid int
json object
json.map string

The name of the map that the layer is on

json.source string

The name of the source that the data will be set on

json.data object | string

The data to set the layer to (this will override old data)

public setFilter(pid: int, json: object) source

Set filter on a layer

Params:

NameTypeAttributeDescription
pid int
json object
json.map string

name for the map (used to reference)

json.layer string

name for the map layer

json.filter array

new filter

public setLayoutProperty(pid: *, json: *) source

Params:

NameTypeAttributeDescription
pid *
json *

public setPaintProperty(pid: *, json: *) source

Params:

NameTypeAttributeDescription
pid *
json *

public setPitch(pid: int, json: object) source

Set pitch of the visible map

Params:

NameTypeAttributeDescription
pid int
json object
json.map string

The map that the querying layer is on

json.pitch int

The map pitch

public zoomIn(pid: int, json: object) source

Zoom in the map

Params:

NameTypeAttributeDescription
pid int
json object
json.map string

The map that the querying layer is on

public zoomOut(pid: int, json: object) source

Zoom out the map

Params:

NameTypeAttributeDescription
pid int
json object
json.map string

The map that the querying layer is on

public zoomTo(pid: int, json: object) source

Zoom the map

Params:

NameTypeAttributeDescription
pid int
json object
json.map string

The map that the querying layer is on

public zoomToBounds(pid: int, json: object) source

Zoom to the bounds of a layer

Params:

NameTypeAttributeDescription
pid int
json object
json.map string

Name of the map the layer is within

json.source string

Name of the layer to zoom in to

json.options int

options as per: https://docs.mapbox.com/mapbox-gl-js/api/#map#fitbounds

public zoomToFeature(pid: int, json: object) source

Zoom /MapboxGL move to a feature

Params:

NameTypeAttributeDescription
pid int
json object
json.map string

The map that the querying layer is on

json.name string

The name of the layer to query

json.property string

The property key to check against

json.value string

The value of the property that we'll be looking for

json.zoom int

The final zoom level for viewing the point

json.minZoom int

The furthest out the map will zoom whilst flying to the point

Private Methods

private addLayer(options: object) source

Add the layer to the map once a source has been created.

Params:

NameTypeAttributeDescription
options object
options.type string

The type of feature that the layer is.

options.name string

The name for the layer

options.paint object

The paint styling for the layer

options.layout object

The layout styling for the layer