【问题标题】:Scrape google street view images of multiple location抓取多个位置的谷歌街景图像
【发布时间】:2018-06-24 11:29:30
【问题描述】:

我想通过代码下载谷歌街景图像,我确实做到了,但我遇到了一些问题。我想用多个位置的 180 度摄像头下载单个街景图像。

为此,我在 python 中使用 pypi 的 google-streetview 1.2.4 库。代码如下。 https://pypi.org/project/google-streetview/ https://rrwen.github.io/google_streetview/#

# Import google_streetview for the api and helper module
import google_streetview.api
import google_streetview.helpers

# Create a dictionary with multiple parameters separated by ;
apiargs = {
  'location': '23.87,90.3939;23.87,90.3944;23.87,90.3951;23.87,90.3959',
  'size': '640x300',
  'heading': '0;90;180',

  'pitch': '0;0;0;0',
  'key': 'google_dev_key'
}

# Get a list of all possible queries from multiple parameters
api_list = google_streetview.helpers.api_list(apiargs)

# Create a results object for all possible queries
results = google_streetview.api.results(api_list)

# Preview results
results.preview()

# Download images to directory 'downloads'
results.download_links('drive/colab/street_view/')

当我使用“标题”像 180 或 90 这样的单个值时,它会显示 pano_id keyerror。

但如果我使用标题 = '0;90;180' 那么它正在下载 12 个相同位置的图像。它重复下载一张图像3次。因为我得到了 4 个位置 4 * 3 总共 12 个街景图像,但我只想下载 4 个位置中的 4 个。我该怎么做 ?

【问题讨论】:

    标签: python web-scraping google-street-view


    【解决方案1】:

    只需将 'pitch': '0;0;0;0' 更改为 'pitch': '0',它会尝试从 4 个 pitch 下载图像,它们都是相同的。

    【讨论】:

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