【问题标题】:iOS Google map SDK: Setting maxZoom level issueiOS Google 地图 SDK:设置 maxZoom 级别问题
【发布时间】:2014-12-05 18:51:19
【问题描述】:

我注意到当我将示例的最大缩放级别设置为 19 时,缩放上升到 20。我不知道为什么。 它总是比我设置的缩放级别高 1 级。

GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:23.589571946369546
                                                        longitude:58.14204730042655
                                                             zoom:16];

self.mapView_.camera=camera;
self.mapView_.myLocationEnabled = YES;


self.mapView_.mapType = kGMSTypeHybrid;
self.mapView_.settings.compassButton = YES;
[self.mapView_ setMinZoom:5 maxZoom:19];



// Creates a marker in the center of the map.
GMSMarker *marker = [[GMSMarker alloc] init];
marker.position = CLLocationCoordinate2DMake(23.168520, 58.008163);

marker.map = self.mapView_;
// ------ add layer
// Implement GMSTileURLConstructor
// Returns a Tile based on the x,y,zoom coordinates, and the requested floor
GMSTileURLConstructor urls = ^(NSUInteger x, NSUInteger y, NSUInteger zoom) {
    NSString *url = [NSString stringWithFormat:@"http://www.example.com/%tu/%tu/%tu.png", zoom, x, y];
    NSLog(@"url=%@",url);
    return [NSURL URLWithString:url];
};

【问题讨论】:

    标签: ios google-maps google-maps-api-3


    【解决方案1】:

    你怎么知道 maxZoom 是 20?您使用哪个版本的 iOS 地图 SDK?

    我使用 iOS Maps SDK 版本 1.9.1 尝试了来自 Google Maps 的 Github 页面的示例 hello map application,并将以下代码放入 videDidLoad() 方法中。它会打印正确的最大缩放比例,即 19。

    GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:23.589571946369546
                                                                longitude:58.14204730042655
                                                                     zoom:16];
    
        mapView_.camera=camera;
        mapView_.myLocationEnabled = YES;
    
        mapView_.mapType = kGMSTypeHybrid;
        mapView_.settings.compassButton = YES;
    
        // Create the GMSMapView with the camera position.
        mapView_ = [GMSMapView mapWithFrame:CGRectZero camera:camera];
    
        [mapView_ setMinZoom:5 maxZoom:19];
    
        NSLog(@"max zoom: %f", mapView_.maxZoom);
    

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-01-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-09
    相关资源
    最近更新 更多