MGLCircleStyleLayer


@interface MGLCircleStyleLayer : MGLVectorStyleLayer

An MGLCircleStyleLayer is a style layer that renders one or more filled circles on the map.

Use a circle style layer to configure the visual appearance of point or point collection features in vector tiles loaded by an MGLVectorSource object or MGLPointAnnotation, MGLPointFeature, MGLPointCollection, or MGLPointCollectionFeature instances in an MGLShapeSource object.

A circle style layer renders circles whose radii are measured in screen units. To display circles on the map whose radii correspond to real-world distances, use many-sided regular polygons and configure their appearance using an MGLFillStyleLayer object.

You can access an existing circle style layer using the -[MGLStyle layerWithIdentifier:] method if you know its identifier; otherwise, find it using the MGLStyle.layers property. You can also create a new circle style layer and add it to the style using a method such as -[MGLStyle addLayer:].

Example

let layer = MGLCircleStyleLayer(identifier: "circles", source: population)
layer.sourceLayerIdentifier = "population"
layer.circleColor = MGLStyleValue(rawValue: .green)
layer.circleRadius = MGLStyleValue(interpolationMode: .exponential,
                                   cameraStops: [12: MGLStyleValue(rawValue: 2),
                                                 22: MGLStyleValue(rawValue: 180)],
                                   options: [.interpolationBase: 1.75])
layer.circleOpacity = MGLStyleValue(rawValue: 0.7)
layer.predicate = NSPredicate(format: "%K == %@", "marital-status", "married")
mapView.style?.addLayer(layer)
  • Returns a circle style layer initialized with an identifier and source.

    After initializing and configuring the style layer, add it to a map view’s style using the -[MGLStyle addLayer:] or -[MGLStyle insertLayer:belowLayer:] method.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithIdentifier:(nonnull NSString *)identifier
                                        source:(nonnull MGLSource *)source;

    Swift

    init(identifier: String, source: MGLSource)

    Parameters

    identifier

    A string that uniquely identifies the source in the style to which it is added.

    source

    The source from which to obtain the data to style. If the source has not yet been added to the current style, the behavior is undefined.

    Return Value

    An initialized foreground style layer.

  • Amount to blur the circle. 1 blurs the circle such that only the centerpoint is full opacity.

    The default value of this property is an MGLStyleValue object containing an NSNumber object containing the float 0. Set this property to nil to reset it to the default value.

    You can set this property to an instance of:

    • MGLConstantStyleValue
    • MGLCameraStyleFunction with an interpolation mode of:
      • MGLInterpolationModeExponential
      • MGLInterpolationModeInterval
    • MGLSourceStyleFunction with an interpolation mode of:
      • MGLInterpolationModeExponential
      • MGLInterpolationModeInterval
      • MGLInterpolationModeCategorical
      • MGLInterpolationModeIdentity
    • MGLCompositeStyleFunction with an interpolation mode of:
      • MGLInterpolationModeExponential
      • MGLInterpolationModeInterval
      • MGLInterpolationModeCategorical

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic, null_resettable)
        MGLStyleValue<NSNumber *> *circleBlur;

    Swift

    var circleBlur: MGLStyleValue<NSNumber>! { get set }
  • The transition affecting any changes to this layer’s circleBlur property.

    This property corresponds to the circle-blur-transition property in the style JSON file format.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) MGLTransition circleBlurTransition;

    Swift

    var circleBlurTransition: MGLTransition { get set }
  • The fill color of the circle.

    The default value of this property is an MGLStyleValue object containing NSColor.blackColor. Set this property to nil to reset it to the default value.

    You can set this property to an instance of:

    • MGLConstantStyleValue
    • MGLCameraStyleFunction with an interpolation mode of:
      • MGLInterpolationModeExponential
      • MGLInterpolationModeInterval
    • MGLSourceStyleFunction with an interpolation mode of:
      • MGLInterpolationModeExponential
      • MGLInterpolationModeInterval
      • MGLInterpolationModeCategorical
      • MGLInterpolationModeIdentity
    • MGLCompositeStyleFunction with an interpolation mode of:
      • MGLInterpolationModeExponential
      • MGLInterpolationModeInterval
      • MGLInterpolationModeCategorical

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic, null_resettable)
        MGLStyleValue<NSColor *> *circleColor;

    Swift

    var circleColor: MGLStyleValue<NSColor>! { get set }
  • The transition affecting any changes to this layer’s circleColor property.

    This property corresponds to the circle-color-transition property in the style JSON file format.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) MGLTransition circleColorTransition;

    Swift

    var circleColorTransition: MGLTransition { get set }
  • The opacity at which the circle will be drawn.

    The default value of this property is an MGLStyleValue object containing an NSNumber object containing the float 1. Set this property to nil to reset it to the default value.

    You can set this property to an instance of:

    • MGLConstantStyleValue
    • MGLCameraStyleFunction with an interpolation mode of:
      • MGLInterpolationModeExponential
      • MGLInterpolationModeInterval
    • MGLSourceStyleFunction with an interpolation mode of:
      • MGLInterpolationModeExponential
      • MGLInterpolationModeInterval
      • MGLInterpolationModeCategorical
      • MGLInterpolationModeIdentity
    • MGLCompositeStyleFunction with an interpolation mode of:
      • MGLInterpolationModeExponential
      • MGLInterpolationModeInterval
      • MGLInterpolationModeCategorical

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic, null_resettable)
        MGLStyleValue<NSNumber *> *circleOpacity;

    Swift

    var circleOpacity: MGLStyleValue<NSNumber>! { get set }
  • The transition affecting any changes to this layer’s circleOpacity property.

    This property corresponds to the circle-opacity-transition property in the style JSON file format.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) MGLTransition circleOpacityTransition;

    Swift

    var circleOpacityTransition: MGLTransition { get set }
  • Orientation of circle when map is pitched.

    The default value of this property is an MGLStyleValue object containing an NSValue object containing MGLCirclePitchAlignmentViewport. Set this property to nil to reset it to the default value.

    You can set this property to an instance of:

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic, null_resettable)
        MGLStyleValue<NSValue *> *circlePitchAlignment;

    Swift

    var circlePitchAlignment: MGLStyleValue<NSValue>! { get set }
  • Circle radius.

    This property is measured in points.

    The default value of this property is an MGLStyleValue object containing an NSNumber object containing the float 5. Set this property to nil to reset it to the default value.

    You can set this property to an instance of:

    • MGLConstantStyleValue
    • MGLCameraStyleFunction with an interpolation mode of:
      • MGLInterpolationModeExponential
      • MGLInterpolationModeInterval
    • MGLSourceStyleFunction with an interpolation mode of:
      • MGLInterpolationModeExponential
      • MGLInterpolationModeInterval
      • MGLInterpolationModeCategorical
      • MGLInterpolationModeIdentity
    • MGLCompositeStyleFunction with an interpolation mode of:
      • MGLInterpolationModeExponential
      • MGLInterpolationModeInterval
      • MGLInterpolationModeCategorical

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic, null_resettable)
        MGLStyleValue<NSNumber *> *circleRadius;

    Swift

    var circleRadius: MGLStyleValue<NSNumber>! { get set }
  • The transition affecting any changes to this layer’s circleRadius property.

    This property corresponds to the circle-radius-transition property in the style JSON file format.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) MGLTransition circleRadiusTransition;

    Swift

    var circleRadiusTransition: MGLTransition { get set }
  • Controls the scaling behavior of the circle when the map is pitched.

    The default value of this property is an MGLStyleValue object containing an NSValue object containing MGLCircleScaleAlignmentMap. Set this property to nil to reset it to the default value.

    This attribute corresponds to the circle-pitch-scale layout property in the Mapbox Style Specification.

    You can set this property to an instance of:

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic, null_resettable)
        MGLStyleValue<NSValue *> *circleScaleAlignment;

    Swift

    var circleScaleAlignment: MGLStyleValue<NSValue>! { get set }
  • The stroke color of the circle.

    The default value of this property is an MGLStyleValue object containing NSColor.blackColor. Set this property to nil to reset it to the default value.

    You can set this property to an instance of:

    • MGLConstantStyleValue
    • MGLCameraStyleFunction with an interpolation mode of:
      • MGLInterpolationModeExponential
      • MGLInterpolationModeInterval
    • MGLSourceStyleFunction with an interpolation mode of:
      • MGLInterpolationModeExponential
      • MGLInterpolationModeInterval
      • MGLInterpolationModeCategorical
      • MGLInterpolationModeIdentity
    • MGLCompositeStyleFunction with an interpolation mode of:
      • MGLInterpolationModeExponential
      • MGLInterpolationModeInterval
      • MGLInterpolationModeCategorical

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic, null_resettable)
        MGLStyleValue<NSColor *> *circleStrokeColor;

    Swift

    var circleStrokeColor: MGLStyleValue<NSColor>! { get set }
  • The transition affecting any changes to this layer’s circleStrokeColor property.

    This property corresponds to the circle-stroke-color-transition property in the style JSON file format.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic)
        MGLTransition circleStrokeColorTransition;

    Swift

    var circleStrokeColorTransition: MGLTransition { get set }
  • The opacity of the circle’s stroke.

    The default value of this property is an MGLStyleValue object containing an NSNumber object containing the float 1. Set this property to nil to reset it to the default value.

    You can set this property to an instance of:

    • MGLConstantStyleValue
    • MGLCameraStyleFunction with an interpolation mode of:
      • MGLInterpolationModeExponential
      • MGLInterpolationModeInterval
    • MGLSourceStyleFunction with an interpolation mode of:
      • MGLInterpolationModeExponential
      • MGLInterpolationModeInterval
      • MGLInterpolationModeCategorical
      • MGLInterpolationModeIdentity
    • MGLCompositeStyleFunction with an interpolation mode of:
      • MGLInterpolationModeExponential
      • MGLInterpolationModeInterval
      • MGLInterpolationModeCategorical

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic, null_resettable)
        MGLStyleValue<NSNumber *> *circleStrokeOpacity;

    Swift

    var circleStrokeOpacity: MGLStyleValue<NSNumber>! { get set }
  • The transition affecting any changes to this layer’s circleStrokeOpacity property.

    This property corresponds to the circle-stroke-opacity-transition property in the style JSON file format.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic)
        MGLTransition circleStrokeOpacityTransition;

    Swift

    var circleStrokeOpacityTransition: MGLTransition { get set }
  • The width of the circle’s stroke. Strokes are placed outside of the circleRadius.

    This property is measured in points.

    The default value of this property is an MGLStyleValue object containing an NSNumber object containing the float 0. Set this property to nil to reset it to the default value.

    You can set this property to an instance of:

    • MGLConstantStyleValue
    • MGLCameraStyleFunction with an interpolation mode of:
      • MGLInterpolationModeExponential
      • MGLInterpolationModeInterval
    • MGLSourceStyleFunction with an interpolation mode of:
      • MGLInterpolationModeExponential
      • MGLInterpolationModeInterval
      • MGLInterpolationModeCategorical
      • MGLInterpolationModeIdentity
    • MGLCompositeStyleFunction with an interpolation mode of:
      • MGLInterpolationModeExponential
      • MGLInterpolationModeInterval
      • MGLInterpolationModeCategorical

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic, null_resettable)
        MGLStyleValue<NSNumber *> *circleStrokeWidth;

    Swift

    var circleStrokeWidth: MGLStyleValue<NSNumber>! { get set }
  • The transition affecting any changes to this layer’s circleStrokeWidth property.

    This property corresponds to the circle-stroke-width-transition property in the style JSON file format.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic)
        MGLTransition circleStrokeWidthTransition;

    Swift

    var circleStrokeWidthTransition: MGLTransition { get set }
  • The geometry’s offset.

    This property is measured in points.

    The default value of this property is an MGLStyleValue object containing an NSValue object containing a CGVector struct set to 0 points rightward and 0 points upward. Set this property to nil to reset it to the default value.

    This attribute corresponds to the circle-translate layout property in the Mapbox Style Specification.

    You can set this property to an instance of:

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic, null_resettable)
        MGLStyleValue<NSValue *> *circleTranslation;

    Swift

    var circleTranslation: MGLStyleValue<NSValue>! { get set }
  • The transition affecting any changes to this layer’s circleTranslation property.

    This property corresponds to the circle-translate-transition property in the style JSON file format.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic)
        MGLTransition circleTranslationTransition;

    Swift

    var circleTranslationTransition: MGLTransition { get set }
  • Controls the translation reference point.

    The default value of this property is an MGLStyleValue object containing an NSValue object containing MGLCircleTranslationAnchorMap. Set this property to nil to reset it to the default value.

    This property is only applied to the style if circleTranslation is non-nil. Otherwise, it is ignored.

    This attribute corresponds to the circle-translate-anchor layout property in the Mapbox Style Specification.

    You can set this property to an instance of:

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic, null_resettable)
        MGLStyleValue<NSValue *> *circleTranslationAnchor;

    Swift

    var circleTranslationAnchor: MGLStyleValue<NSValue>! { get set }