MLNVectorTileSource class

MLNVectorTileSource is a map content source that supplies tiled vector data in Mapbox Vector Tile format to be shown on the map. The location of and metadata about the tiles are defined either by an option dictionary or by an external file that conforms to the TileJSON specification. A vector tile source is added to an MLNStyle object along with one or more MLNVectorStyleLayer objects. A vector style layer defines the appearance of any content supplied by the vector tile source.

MLNVectorTileSource is optimized for data sets that are too large to fit completely in memory, such as vector tile sets or data sets managed in Mapbox Studio. For GeoJSON data, use the MLNShapeSource class. For tiled data that changes dynamically, the MLNComputedShapeSource class may be a suitable alternative.

Each vector source defined by the style JSON file is represented at runtime by an MLNVectorTileSource object that you can use to initialize new style layers. You can also add and remove sources dynamically using methods such as MLNStyle/addSource: and MLNStyle/sourceWithIdentifier:.

Within each vector tile, each geometric coordinate must lie between −1 × extent and (extent × 2) − 1, inclusive. Any vector style layer initialized with a vector tile source must have a non-nil value in its sourceLayerIdentifier property.

Commonly used vector tile sources include Mapbox Streets, Mapbox Terrain, and Mapbox Traffic.

Example

let source = MLNVectorTileSource(identifier: "pois", tileURLTemplates:
["https://example.com/vector-tiles/{z}/{x}/{y}.mvt"], options: [ .minimumZoomLevel: 9,
.maximumZoomLevel: 16,
.attributionInfos: [
MLNAttributionInfo(title: NSAttributedString(string: "© Mapbox"), url: URL(string:
"https://mapbox.com"))
]
])
mapView.style?.addSource(source)

TODO: Data-driven circles, learn how to add data to your map using an MLNVectorTileSource object.

Inheritance

Constructors

MLNVectorTileSource()
Returns a new instance of MLNVectorTileSource constructed with the default new method.
factory
MLNVectorTileSource.castFrom(ObjCObjectBase other)
Constructs a MLNVectorTileSource that points to the same underlying object as other.
MLNVectorTileSource.castFromPointer(Pointer<ObjCObject> other, {bool retain = false, bool release = false})
Constructs a MLNVectorTileSource that wraps the given raw object pointer.

Properties

attributionHTMLString → NSString?
The attribution HTML string associated with this source.
no setterinherited
attributionInfos → NSArray
An array of MLNAttributionInfo objects that define the attribution statements to be displayed when the map is shown to the user.
no setterinherited
configurationURL → NSURL?
The URL to the TileJSON configuration file that specifies the contents of the source.
no setterinherited
debugDescription$1 → NSString
debugDescription
no setterinherited
description$1 → NSString
description
no setterinherited
hash$1 int
hash
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
identifier ↔ NSString
A string that uniquely identifies the source in the style to which it is added.
getter/setter pairinherited
isProxy bool
isProxy
no setterinherited
ref → ObjCObjectRef
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
superclass$1 → ObjCObjectBase
superclass
no setterinherited

Methods

autorelease() MLNVectorTileSource
autorelease
override
class$1() → ObjCObjectBase
class
inherited
conformsToProtocol$1(Protocol aProtocol) bool
conformsToProtocol:
inherited
copy() → ObjCObjectBase
copy
inherited
dealloc() → void
dealloc
inherited
doesNotRecognizeSelector(Pointer<ObjCSelector> aSelector) → void
doesNotRecognizeSelector:
inherited
featuresInSourceLayersWithIdentifiers(NSSet sourceLayerIdentifiers, {NSPredicate? predicate}) → NSArray
Returns an array of map features loaded by this source, restricted to the given source layers and filtered by the given predicate.
forwardingTargetForSelector(Pointer<ObjCSelector> aSelector) → ObjCObjectBase
forwardingTargetForSelector:
inherited
forwardInvocation(NSInvocation anInvocation) → void
forwardInvocation:
inherited
init() MLNVectorTileSource
init
override
initWithIdentifier(NSString identifier, {required NSURL configurationURL}) MLNVectorTileSource
Returns a vector tile source initialized with an identifier and configuration URL.
initWithIdentifier$1(NSString identifier, {required NSString configurationURLString}) MLNVectorTileSource
Returns a vector tile source initialized with an identifier and a string-based configuration URL.
initWithIdentifier$2(NSString identifier, {required NSArray tileURLTemplates, NSDictionary? options}) MLNVectorTileSource
Returns a vector tile source initialized an identifier, tile URL templates, and options.
initWithIdentifier_(NSString identifier) MLNVectorTileSource
Returns a source initialized with an identifier.
override
isEqual(ObjCObjectBase object) bool
isEqual:
inherited
isKindOfClass(ObjCObjectBase aClass) bool
isKindOfClass:
inherited
isMemberOfClass(ObjCObjectBase aClass) bool
isMemberOfClass:
inherited
methodForSelector(Pointer<ObjCSelector> aSelector) Pointer<NativeFunction<Void Function()>>
methodForSelector:
inherited
methodSignatureForSelector(Pointer<ObjCSelector> aSelector) → NSMethodSignature
methodSignatureForSelector:
inherited
mutableCopy() → ObjCObjectBase
mutableCopy
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
performSelector(Pointer<ObjCSelector> aSelector) → ObjCObjectBase
performSelector:
inherited
performSelector$1(Pointer<ObjCSelector> aSelector, {required ObjCObjectBase withObject}) → ObjCObjectBase
performSelector:withObject:
inherited
performSelector$2(Pointer<ObjCSelector> aSelector, {required ObjCObjectBase withObject, required ObjCObjectBase withObject$1}) → ObjCObjectBase
performSelector:withObject:withObject:
inherited
release() → void
release
inherited
respondsToSelector(Pointer<ObjCSelector> aSelector) bool
respondsToSelector:
inherited
retain() MLNVectorTileSource
retain
override
retainCount() int
retainCount
inherited
self$1() MLNVectorTileSource
self
override
toString() String
A string representation of this object.
inherited
zone() Pointer<NSZone>
zone
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

alloc() MLNVectorTileSource
alloc
override
allocWithZone(Pointer<NSZone> zone) MLNVectorTileSource
allocWithZone:
override
isInstance(ObjCObjectBase obj) bool
Returns whether obj is an instance of MLNVectorTileSource.
override
new$() MLNVectorTileSource
new
override