MGLVectorStyleLayer
@interface MGLVectorStyleLayer : MGLForegroundStyleLayer
MGLVectorStyleLayer is an abstract superclass for style layers whose content
is defined by an MGLShapeSource or MGLVectorTileSource object.
Create instances of MGLCircleStyleLayer, MGLFillStyleLayer,
MGLFillExtrusionStyleLayer, MGLHeatmapStyleLayer, MGLLineStyleLayer, and
MGLSymbolStyleLayer in order to use MGLVectorStyleLayer‘s properties and
methods. Do not create instances of MGLVectorStyleLayer directly, and do not
create your own subclasses of this class.
-
Identifier of the layer within the source identified by the
sourceIdentifierproperty from which the receiver obtains the data to style.Declaration
Objective-C
@property (nonatomic, nullable) NSString *sourceLayerIdentifier;Swift
var sourceLayerIdentifier: String? { get set } -
The style layer’s predicate.
Use the style layer’s predicate to include only the features in the source layer that satisfy a condition that you define. If the style layer initially comes from the style, its predicate corresponds to the
filterproperty in the style JSON.See the “Predicates and Expressions” guide for details about the predicate syntax supported by this class.
Example
To filter the layer to include only the features whose
indexattribute is 5 or 10 and whoseeleattribute is at least 1,500, you could create anNSCompoundPredicatealong these lines:let layer = MGLLineStyleLayer(identifier: "contour", source: terrain) layer.sourceLayerIdentifier = "contours" layer.predicate = NSPredicate(format: "(index == 5 || index == 10) && CAST(ele, 'NSNumber') >= 1500.0") mapView.style?.addLayer(layer)Declaration
Objective-C
@property (nonatomic, nullable) NSPredicate *predicate;Swift
var predicate: NSPredicate? { get set }
Install in Dash
MGLVectorStyleLayer Class Reference