-
The
DingiFeature
protocol is used to provide details about geographic features contained in anDingiShapeSource
orDingiVectorTileSource
object. Each concrete subclass ofMGLShape
in turn has a subclass that conforms to this protocol. A feature object associates a shape with an optional identifier and attributes.You can add custom data to display on the map by creating feature objects and adding them to an
DingiShapeSource
using the-[DingiShapeSource initWithIdentifier:shape:options:]
method orDingiShapeSource.shape
property.In addition to adding data to the map, you can also extract data from the map:
-[DingiMapView visibleFeaturesAtPoint:]
and related methods return feature objects that correspond to features in the source. This enables you to inspect the properties of features in vector tiles loaded byDingiVectorTileSource
objects. You also reuse these feature objects as overlay annotations.While it is possible to add
DingiFeature
-conforming objects to the map as annotations using-[DingiMapView addAnnotations:]
and related methods, doing so has trade-offs:Features added as annotations will not have
identifier
orattributes
properties when used with feature querying.Features added as annotations become interactive. Taps and selection can be handled in
-[DingiMapViewDelegate mapView:didSelectAnnotation:]
.
Declaration
Objective-C
@protocol DingiFeature <DingiAnnotation>
Swift
protocol DingiFeature : DingiAnnotation
-
An
DingiPointFeature
object associates a point shape with an optional identifier and attributes.Declaration
Objective-C
@interface DingiPointFeature : DingiPointAnnotation <DingiFeature>
Swift
class DingiPointFeature : DingiPointAnnotation, DingiFeature
-
An
DingiPolygonFeature
object associates a polygon shape with an optional identifier and attributes.Declaration
Objective-C
@interface DingiPolygonFeature : DingiPolygon <DingiFeature>
Swift
class DingiPolygonFeature : DingiPolygon, DingiFeature
-
An
DingiPolylineFeature
object associates a polyline shape with an optional identifier and attributes.A polyline feature is known as a LineString feature in GeoJSON.
Declaration
Objective-C
@interface DingiPolylineFeature : DingiPolyline <DingiFeature>
Swift
class DingiPolylineFeature : DingiPolyline, DingiFeature
-
An
DingiMultiPolygonFeature
object associates a multipolygon shape with an optional identifier and attributes.Declaration
Objective-C
@interface DingiMultiPolygonFeature : DingiMultiPolygon <DingiFeature>
Swift
class DingiMultiPolygonFeature : DingiMultiPolygon, DingiFeature
-
An
DingiMultiPolylineFeature
object associates a multipolyline shape with an optional identifier and attributes.A multipolyline feature is known as a MultiLineString feature in GeoJSON.
Declaration
Objective-C
@interface DingiMultiPolylineFeature : DingiMultiPolyline <DingiFeature>
Swift
class DingiMultiPolylineFeature : DingiMultiPolyline, DingiFeature
-
An
DingiPointCollectionFeature
object associates a point collection with an optional identifier and attributes.A point collection feature is known as a MultiPoint feature in GeoJSON.
Declaration
Objective-C
@interface DingiPointCollectionFeature : DingiPointCollection <DingiFeature>
Swift
class DingiPointCollectionFeature : DingiPointCollection, DingiFeature
-
An
DingiShapeCollectionFeature
object associates a shape collection with an optional identifier and attributes.DingiShapeCollectionFeature
is most commonly used to add multiple shapes to a singleDingiShapeSource
. Configure the appearance of anDingiSource
’s shape collection collectively using anDingiSymbolStyleLayer
object, or use multiple instances ofDingiCircleStyleLayer
,DingiFillStyleLayer
, andDingiLineStyleLayer
to configure the appearance of each kind of shape inside the collection.A shape collection feature is known as a feature collection in GeoJSON.
Declaration
Objective-C
@interface DingiShapeCollectionFeature : DingiShapeCollection <DingiFeature>
Swift
class DingiShapeCollectionFeature : DingiShapeCollection, DingiFeature