【问题标题】:does not display all the overlays, generating from kml file不显示所有覆盖,从 kml 文件生成
【发布时间】:2014-01-11 10:11:59
【问题描述】:

我正在从我存储在我的文档目录中的 kml 文件中绘制地图叠加层。我一次查看大约 30 到 40 个 kml 文件,线条颜色存储在 kml 中。问题是其中一些没有显示。

- (MKOverlayView *)mapView:(MKMapView *)mapView viewForOverlay:(id <MKOverlay>)overlay
{
    return [kmlParser viewForOverlay:overlay];
}

以上代码来自参考KMLViewer,可以从here下载

当我编写下面的代码时,它工作得非常好,但所有生成的 kml 文件都以黑色绘制

- (MKOverlayView *)mapView:(MKMapView *)mapView viewForOverlay:(id <MKOverlay>)overlay
{
        MKOverlayPathView *overlayPathView;

        if ([overlay isKindOfClass:[MKPolygon class]])
        {
            overlayPathView = [[MKPolygonView alloc] initWithPolygon:(MKPolygon*)overlay];

            overlayPathView.fillColor = [[UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:1.0] colorWithAlphaComponent:0.2];
            overlayPathView.strokeColor = [[UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:1.0] colorWithAlphaComponent:0.7];
            overlayPathView.lineWidth = 3;

            return overlayPathView;
        }
}

任何帮助将不胜感激!

谢谢。

【问题讨论】:

  • 已解决 boundingMapRect 问题

标签: ios iphone objective-c kml


【解决方案1】:

boundingMapRect 可能是罪魁祸首,请检查地图的缩放级别及其 boundingmaprect 属性

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-06-20
    • 2015-03-22
    • 2013-04-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-12-02
    相关资源
    最近更新 更多