【问题标题】:Google Street View JS - FoV & FoV EventGoogle Street View JS - FoV 和 FoV 事件
【发布时间】:2017-08-31 04:50:01
【问题描述】:

我正在构建一个使用来自 Google Street View API 的图像的应用。我需要放大图像。

我正在使用事件pov_changed,我跟踪 POV 间距和航向的变化。要决定最终图像的缩放比例,我需要一个 FoV(视野)属性。

https://maps.googleapis.com/maps/api/streetview?size=700x600&location=40.159172842909,-103.201315097248&heading=22.3118227257402&pitch=-1.42049583899625&key=<key>&fov=20

我有这样的设置...

  center = new google.maps.LatLng(address.latitude, address.longitude)

  map = new google.maps.Map(document.getElementById('map'), {
    center: center,
    zoom: address.zoom
  })

  street = new google.maps.StreetViewPanorama(document.getElementById('street'), {
    position: center,
    pov: {
      heading: address.pov_heading || 150,
      pitch: address.pov_pitch || 0.75
    }
  })

要获取更新表单的值,我有一些类似...但我找不到如何获取视野属性。

  street.addListener 'pov_changed', ->
    pitchField.html(street.getPov().pitch)
    headingField.html(street.getPov().heading)
    # console.log(street.getFov()) # is not a function
    # console.log(street.getFoV()) # is not a function
    # console.log(street.getFOV()) # is not a function

如何找到在上述链接中使用的视野以放大图像。

【问题讨论】:

标签: google-maps google-street-view fieldofview


【解决方案1】:

您无法获取 FOV,它不在 API 中 https://developers.google.com/maps/documentation/javascript/3.exp/reference

正如 anatoly.sukhanov 所发布的,您可以在 SO how can I determine the Field of View a street view panorama map is using 上已经提出的这个问题中找到计算方法

【讨论】:

    猜你喜欢
    • 2014-08-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-04-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多