Layers
setLayer
map.setLayer(layer,id,source,type,filter,minzoom,maxzoom,layout,paint,beforelayerid);
Parameters
layer
The layer to add.
Object
id
A unique identifier that you define
String
source
The data source for the layer. Reference a source that has already been defined using the source's unique id.
String
filter
An expression specifying conditions on source features. Only features that match the filter are displayed.
Array
minZoom
The minimum zoom level for the layer.
Numeric
maxZoom
The maximum zoom level for the layer.
Numeric
layout
Layout properties for the layer Available layout properties vary by layer.type.
Object
paint
Paint properties for the layer
Available paint properties vary by layer.type.
Object
beforeLayerID
The ID of an existing layer to insert the new layer before, resulting in the new layer appearing visually beneath the existing layer.
String
Returns
Example
map.setLayer({
id: 'some Layer ID',
// References the GeoJSON source defined above
// and does not require a `source-layer`
source: 'some Source ID',
//Style Specification
type: 'symbol',
layout: {
// Set the label content to the
// feature's `name` property
'text-field': ['get', 'name'] //or String
}
paint: {
'text-color' : '#000000'
}
});
getLayer
map.getLayer(id);
Parameters
id
The ID of the layer to get.
String
Returns
Example
const stateDataLayer = map.getLayer('3d_building-kor');
type
moveLayer
map.moveLayer(id, beforlayerID)
Parameters
id
The ID of the layer to move.
String
beforeLayerID
The ID of an existing layer to insert the new layer before. When viewing the map, the id
layer will appear beneath the beforeId
layer.
String
Returns
Example
map.moveLayer('3d_building-kor', 'landuse');
removeLayer
map.removeLayer(id);
Parameters
id
ID of the layer to remove.
String
Returns
Example
// Some code
The MOGOS Maps API requires an API Key, which can be obtained from the MOGOS Console website or contact [email protected].
Last updated