【问题标题】:Mapbox iOS SDK dynamic styling coordinate bounds crashMapbox iOS SDK 动态样式坐标边界崩溃
【发布时间】:2019-03-11 06:11:02
【问题描述】:

我正在尝试解决 Mapbox 示例中的水彩栅格图层示例,并根据文档添加额外的边界框参数。该应用程序总是崩溃并出现 NSException 并且没有进一步的见解。

  func mapView(_ mapView: MGLMapView, didFinishLoading style: MGLStyle) {
    let bounds = MGLCoordinateBounds(sw: CLLocationCoordinate2D(latitude: -180, longitude: -85.05112877980659), ne: CLLocationCoordinate2D(latitude: 180, longitude: 85.0511287798066))
    let source = MGLRasterTileSource(identifier: "stamen-watercolor", tileURLTemplates: ["https://stamen-tiles.a.ssl.fastly.net/watercolor/{z}/{x}/{y}.jpg"], options: [ .tileSize: 256, .coordinateBounds: bounds])
    let rasterLayer = MGLRasterStyleLayer(identifier: "stamen-watercolor", source: source)

    style.addSource(source)
    style.addLayer(rasterLayer) }

是否不支持此选项参数?还是我做错了什么?

【问题讨论】:

    标签: ios swift crash mapbox bounding-box


    【解决方案1】:

    发现问题不在于将边界添加为 NSValue,而只是将它们添加为 MGLCoordinateBounds。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-06-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多