有没有一种方法可以使用Google Street View API并仅返回“侧视图"? [英] Is there a way to use the Google Street View API and only return "side view"?

查看:100
本文介绍了有没有一种方法可以使用Google Street View API并仅返回“侧视图"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从侧面看,我的意思是图像中的摄像头面向垂直于街道并面向沿着街道的人行道.一个例子就是这样的图片:

By side view I mean images where the camera is facing perpendicular to the street and facing the sidewalk that runs along the street. An example would be like this image:

http://cdn.timesofisrael.com/uploads/2015/12/Screen-Shot-2015-12-02-at-1.59.53-AM.png

到目前为止,我一直在使用指南针针对每条街道明确测量航向参数,这使我可以获得侧视图图像,但是这是不可缩放的. Google街景视图是否可以通过某种方式将侧视图"设置为布尔值,或者是否存在现有的实现可以动态返回所需标题的位置以实现侧视图的实现?看来这将是一个常见的用例/要求,因此必须有一种方法可以做到这一点,即不必手动为每个地址手动设置标题.

For now I have been measuring the heading parameter explicitly with a compass for each street and that has allowed me to get side view images but this is not scaleable. Does Google Street View have some way to set this "side view" boolean in some way or is there existing implementations that can dynamically return the desired heading for a position to achieve side view? It seems like this would be a common use case/requirment so there must be a way to do this that isn't manually setting the heading by hand for each address.

到目前为止,这是我的代码,您可以看到我正在为街景视图请求设置标题"参数(这是介于0到360之间的数字),但是我不想每次都要手动执行此操作时间..

Here is my code so far, you can see i am setting a "heading" parameter to the street view request (this is a number between 0 and 360), but i don't want to have to do this manually every time..

import urllib, os

myloc = "/Users/me/Desktop" 
key = "&key=" + "MYKEY" 

def GetStreet(Add,SaveLoc):
  base = "https://maps.googleapis.com/maps/api/streetview?size=1200x800&heading=3&location="
  MyUrl = base + Add + key
  fi = Add + ".jpg"
  urllib.urlretrieve(MyUrl, os.path.join(SaveLoc,fi))


Tests = []

for sampleAddress in range(488, 1501, 30):
  Tests.append(str(sampleAddress) + " Eighth Avenue, San Diego, CA 92101")

for i in Tests:
  GetStreet(Add=i,SaveLoc=myloc)

推荐答案

您可以从Google Maps Javascript API v3

You can get information about where the camera was pointing (the direction the car was travelling) from the Google Maps Javascript API v3 StreetViewPov

StreetViewPov对象规范
google.maps.StreetViewPov对象规范
一个视点对象,用于指定相机在街景全景图位置处的方向.视点定义为航向和俯仰.

StreetViewPov object specification
google.maps.StreetViewPov object specification
A point of view object which specifies the camera's orientation at the Street View panorama's position. The point of view is defined as heading and pitch.

属性

标题 |类型:数字
摄像机相对于真北的方位角.正确的北是0°,东是90°,南是180°,西是270°.
间距 |类型:数字
相机相对于街景车的俯仰角度(以度为单位).范围从90°(直接向上)到-90°(直接向下).

Properties

heading | Type: number
The camera heading in degrees relative to true north. True north is 0°, east is 90°, south is 180°, west is 270°.
pitch | Type: number
The camera pitch in degrees, relative to the street view vehicle. Ranges from 90° (directly upwards) to -90° (directly downwards).

(很遗憾,此信息在StreetView Image API 元数据)

(unfortunately this information isn't available in the StreetView Image API metadata)

这篇关于有没有一种方法可以使用Google Street View API并仅返回“侧视图"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆