2014-12-22 1 views
1

최대 확대/축소 수준을 예제 19로 설정하면 타일을 사용할 때 확대/축소가 최대 20까지 증가합니다. 나는 이유를 모른다. 그것은 내가 설정 한 것보다 항상 1 배 더 줌 레벨입니다.iOS Google지도 SDK : 타일 사용시 maxZoom 수준 문제 설정

는 (이것은 구글 SDKDemo 예에서, 난 그냥 내 도메인을 가리 키도록 URL을 변경) 예를 들어 아래를 참조하십시오 :

GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:23.614328 
                  longitude:58.545284 
                   zoom:18]; 

    mapView_ = [GMSMapView mapWithFrame:CGRectZero camera:camera]; 

    [mapView_ setMinZoom:5 maxZoom:19]; 
    //mapView_.buildingsEnabled = NO; 
    //mapView_.indoorEnabled = NO; 
    mapView_.mapType = kGMSTypeHybrid; 
    self.view = mapView_; 

tileLayer_.map = nil; 

    // Create a new GMSTileLayer with the new floor choice. 
    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]; 
    }; 
    tileLayer_ = [GMSURLTileLayer tileLayerWithURLConstructor:urls]; 
    tileLayer_.map = mapView_; 

을 지금, 나는이에 줌을 유지하는 경우 I 인쇄 로그 얻을 것이다.

2014년 12월 22일 20 : 06 : 02.342 SDKDemos [1792 : 941894] URL : 최대 나는 19 공지 사항으로 설정,하지만 http://www.example.com/20/694778/453520.png

공지 사항, 도메인 후 줌 레벨은 20입니다, 난 Google SDK 버전 1.9 사용

답변

2

GMSTileURLConstructor의 확대/축소가 MapView의 확대/축소와 다릅니다.

나는 다음처럼 GMSTileURLConstructor 블록 내부의 일부 NSLog를 넣어 시도 :

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); 
     NSLog(@"max zoom: %f", mapView_.maxZoom); 
     NSLog(@"max tileLayer zoom: %f", tileLayer_.map.maxZoom); 
     return [NSURL URLWithString:url]; 
    }; 

2014-12-22 08:56:07.959 HelloMap[30797:1797670] max zoom: 19.000000 
2014-12-22 08:56:07.959 HelloMap[30797:1797670] max tileLayer zoom: 19.000000 

을 인쇄 this answer 당신을 도울 수있는 나는 생각한다. 답에서

부 :

* "카메라의 줌 플로트 동안 GMSTileLayer의 줌 NSUInteger입니다 GMSTileLayer의 줌 타일의 수를 결정하는 데 사용되는 카메라의 줌을 사용하는 동안.. 수식 256 * 2N을 기준으로 포인트 수를 결정하십시오. "*

관련 문제