Mapbox
Extends:
Member Summary
Public Members | ||
public |
maps: {} |
|
public |
overlays: {} |
|
public |
popup: * |
|
public |
queue: * |
|
public |
|
Method Summary
Public Methods | ||
public |
addClick(pid: *, json: *) |
|
public |
Load images for use as icons (needs to be run prior to layer addition) |
|
public |
Create a new mapbox gl map |
|
public |
Add a popup to the map |
|
public |
Add a select control to a layer |
|
public |
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 the visible map |
|
public |
Set the data for a layer |
|
public |
Set filter on a layer |
|
public |
setLayoutProperty(pid: *, json: *) |
|
public |
setPaintProperty(pid: *, json: *) |
|
public |
Set pitch of the visible map |
|
public |
Zoom in the map |
|
public |
Zoom out the map |
|
public |
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 |
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 Methods
public addClick(pid: *, json: *) source
Params:
Name | Type | Attribute | Description |
pid | * | ||
json | * |
public addImages(pid: int, json: object) source
Load images for use as icons (needs to be run prior to layer addition)
public addMap(pid: int, json: object) source
Create a new mapbox gl map
Params:
Name | Type | Attribute | Description |
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 addSource(pid: int, json: object) source
Add a new source and layer to the map
Params:
Name | Type | Attribute | Description |
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
public getMapDetails(pid: int, json: object) source
Set a memory mapDetails to have current info on the state of the map
public init(queue: *) source
init, override this for any promise based inits setting the self.ready=true after the promise
Override:
Queueable#initParams:
Name | Type | Attribute | Description |
queue | * |
public manualSelect(pid: *, json: *) source
Params:
Name | Type | Attribute | Description |
pid | * | ||
json | * |
public paintQueryFeatures(pid: int, json: object) source
Query and highlight feature depending on the paint features
Params:
Name | Type | Attribute | Description |
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:
Name | Type | Attribute | Description |
pid | * | ||
json | * |
public removeEditTools(pid: *, json: *) source
Params:
Name | Type | Attribute | Description |
pid | * | ||
json | * |
public setLayoutProperty(pid: *, json: *) source
Params:
Name | Type | Attribute | Description |
pid | * | ||
json | * |
public setPaintProperty(pid: *, json: *) source
Params:
Name | Type | Attribute | Description |
pid | * | ||
json | * |
public zoomToBounds(pid: int, json: object) source
Zoom to the bounds of a layer
Params:
Name | Type | Attribute | Description |
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:
Name | Type | Attribute | Description |
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 |