使用谷歌地图sdk检查谷歌街景的可用性

时间:2016-09-22 06:48:50

标签: ios objective-c xcode google-api google-maps-sdk-ios

我使用Google Maps SDK iOS v 2.0.1.使用GMSPanoramaView class,我能够显示街景可用的点的街景,但在街景不可用的坐标处,在全景视图中没有显示任何内容,进度指示器继续旋转。

有没有办法使用google Google Maps SDK iOS来查看特定坐标附近objective c街景的可用性?

2 个答案:

答案 0 :(得分:2)

检查某个位置的街景全景是否存在?你必须使用GMSPanoramaViewDelegate

GROUP BY

你也可以在moveNearCoordinate:生成错误时调用。

- (void) panoramaView:      (GMSPanoramaView *)     view
didMoveToPanorama:      (GMSPanorama *_Nullable)    panorama {
   //If the panorama.panoramaID NSString is null, then the panorama could not be loaded.
}

希望这能帮到你......

答案 1 :(得分:0)

检查全景图元数据(请求是免费的)。请求实际全景图不是。来源:https://developers.google.com/maps/documentation/streetview/metadatahttps://developers.google.com/maps/documentation/ios-sdk/reference/interface_g_m_s_panorama_service#public-member-functions

let service = GMSPanoramaService()

func checkForPanorama(at coordinate: CLLocationCoordinate2D) {

    service.requestPanoramaNearCoordinate(coordinate) { (panorama, error) in
        if let error = error {
            // No panorama
            print(error.localizedDescription)
        } else if let panorama = panorama {
            print("Panorama id: \(panorama.panoramaID)")
        } else {
            print("Something went wrong")
        }
    }
}