featuresInSourceLayersWithIdentifiers method
- NSSet sourceLayerIdentifiers, {
- NSPredicate? predicate,
Returns an array of map features loaded by this source, restricted to the given source layers and filtered by the given predicate.
Each object in the returned array represents a feature loaded by the source and
provides access to attributes specified as part of the loaded feature. The
source loads a feature if the source is added to an MLNMapView’s style; that
style has a layer that uses the source; and the map view has recently scrolled
to the region containing the feature.
Features come from tiled vector data that is converted to tiles internally, so feature geometries are clipped at tile boundaries and features may appear duplicated across tiles. For example, suppose part of a lengthy polyline representing a road has recently scrolled into view. The resulting array includes those parts of the road that lie within the map tiles that the source has loaded, even if the road extends into other tiles. The portion of the road within each map tile is included individually.
Returned features may not necessarily be visible to the user at the time they
are loaded: the style may contain a layer that forces the source’s tiles to
load but filters out the features in question, preventing them from being
drawn. To obtain only visible features, use the
MLNMapView/visibleFeaturesAtPoint:inStyleLayersWithIdentifiers:predicate:
or
MLNMapView/visibleFeaturesInRect:inStyleLayersWithIdentifiers:predicate:
method.
@param sourceLayerIdentifiers The source layers to include in the query. Only
the features contained in these source layers are included in the returned
array. This array may not be empty.
@param predicate A predicate to filter the returned features. Use nil to
include all loaded features.
@return An array of objects conforming to the MLNFeature protocol that
represent features loaded by the source that match the predicate.
Implementation
objc.NSArray featuresInSourceLayersWithIdentifiers(objc.NSSet sourceLayerIdentifiers, {NSPredicate? predicate}) {
final _ret = _objc_msgSend_15qeuct(this.ref.pointer, _sel_featuresInSourceLayersWithIdentifiers_predicate_, sourceLayerIdentifiers.ref.pointer, predicate?.ref.pointer ?? ffi.nullptr);
return objc.NSArray.castFromPointer(_ret, retain: true, release: true);
}