Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

Clarify how to use MGLImageSource in the header's example. #10148

Closed

Description

@fabian-guerra

The example in MGLImageSource's does not mention the use of MGLRasterStyleLayer it should be updated to reflect how to use it.

The fixed version (from this comment) should be:

func mapView(_ mapView: MGLMapView, didFinishLoading style: MGLStyle) {
        let coordinates = MGLCoordinateQuad(
            topLeft: CLLocationCoordinate2D(latitude: 46.437, longitude: -80.425),
            bottomLeft: CLLocationCoordinate2D(latitude: 37.936, longitude: -80.425),
            bottomRight: CLLocationCoordinate2D(latitude: 37.936, longitude: -71.516),
            topRight: CLLocationCoordinate2D(latitude: 46.437, longitude: -71.516))
        let source = MGLImageSource(identifier: "radar", coordinateQuad: coordinates, url: URL(string: "https://www.mapbox.com/mapbox-gl-js/assets/radar.gif")!)
        style.addSource(source)
        
        let layer = MGLRasterStyleLayer(identifier: "radar-layer", source: source)
        layer.rasterOpacity = MGLStyleValue(rawValue: 0.5)
        style.addLayer(layer)
}

Activity

  1. added
    iOS
    macOS
    on Oct 6, 2017
  2. jmkiley commented on Oct 6, 2017

    @jmkiley
    Contributor

    Added in #10149

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationiOSmacOS

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions