How to connect one pano to multiple panos using Google street view publish API?

空扰寡人 提交于 2019-11-28 14:22:08

I've seen that your request URL is:

https://streetviewpublish.googleapis.com/v1/photo/{}?key={}&updateMask=connections'.format("pano_1","AIzdesdfyxscvvvvvvvvvvvvvvv")

In order to connect multiple photos, you need to use the batchUpdate method.

HTTP request

POST https://streetviewpublish.googleapis.com/v1/photos:batchUpdate?

Here's a sample request using curl:

curl --request POST \
    --url 'https://streetviewpublish.googleapis.com/v1/photos:batchUpdate' \
    --header 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
     --header 'Content-Type: application/json' \
     --data '{
              "updatePhotoRequests": [
            {
            "updateMask": "connections",
               "photo": {
                "photoId": {
                   "id": "pano_1"
                },
                "connections": [
                   {
                       "target": {
                        "id": "pano_2"
                         }
                           },
                           {
                       "target": {
                        "id": "pano_3"
                             }
                           }
                        ]
                        }
                   }
                ]
              }'

Update: If I have four panos and I want to connect pano_1 -> pano_2, pano_3 and pano_3 -> pano_4 then what will be the json format?

You should make pano_4 as your target to be connected to pano_3.

{
  "updatePhotoRequests": [
    {
      "updateMask": "connections",
      "photo": {
        "photoId": {
          "id": "pano_3"
        },
        "connections": [
          {
            "target": {
              "id": "pano_4"
            }
          },
        ]
      }
    }
  ]
}

Just be noted that the id should be photoId of the uploaded photo.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!