MGLFeature

The MGLFeature protocol is used to provide details about geographic features
contained in a map view’s
tile sources.
Each concrete subclass of MGLShape in turn has a subclass that conforms to
this protocol.

Typically, you do not create feature objects yourself but rather obtain them
using -[MGLMapView visibleFeaturesAtPoint:] and related methods. Each feature
object associates a shape with an identifier and attributes as specified by the
source. Like ordinary MGLAnnotation objects, some kinds of MGLFeature
objects can also be added to a map view using -[MGLMapView addAnnotations:]
and related methods.

Declaration

A dictionary of attributes for this feature specified by the
tile source.

The keys and values of this dictionary are determined by the tile source. In
the tile source, each attribute name is a string, while each attribute value
may be a null value, Boolean value, integer, floating-point number, or string.
These data types are mapped to instances of the following Foundation classes:

In the tile source

In this dictionary

Null

NSNull

Boolean

NSNumber (use the boolValue property)

Integer

NSNumber (use the unsignedLongLongValue or longLongValue property)

Floating-point number

NSNumber (use the doubleValue property)

String

NSString

For details about the attribute names and values found in Mapbox-provided
vector tile sources, consult the
Mapbox Streets
and
Mapbox Terrain
layer references.