使用 google map sdk for ios 检查 google 街景的可用性

check availability of google street view using google map sdk for ios

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

有没有什么方法可以使用 Google Maps SDK for iOS in objective c 检查特定坐标附近 google 街景的可用性?

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

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

您还可以在 moveNearCoordinate: 产生错误时调用。

- (void) panoramaView:      (GMSPanoramaView *)     view
error:      (NSError *)     error
onMoveNearCoordinate:       (CLLocationCoordinate2D)    coordinate {
}

希望这对你有帮助...

检查全景元数据(请求免费)。请求实际全景不是。资料来源:https://developers.google.com/maps/documentation/streetview/metadata and https://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")
        }
    }
}