如何使用街景发布API发布多级拍摄

时间:2017-07-27 14:45:32

标签: python google-maps google-api google-street-view google-streetview-publish

我正在尝试使用街景发布API发布多级拍摄,但Google地图上没有显示级别。

我发送了以下python请求,用于上传照片的元数据:

请求等级1:

metadata_upload_url = "https://streetviewpublish.googleapis.com/v1/photo?key={}".format(API_KEY)
    headers = {"Authorization": "Bearer {}".format(ACCESS_KEY), "Content-Length": "0",
               "Content-Type": "application/json"}
    data = {

        "uploadReference": {
            "uploadUrl": "https://streetviewpublish.googleapis.com/media/user/100547264652003378315/photo/5844140439745949662"
        },
        "pose": {
            "latLngPair": {
                "latitude": 18.51314,
                "longitude": 73.85670
            },
            "heading": 0.0,
            "pitch": 0.0,
            "level": {
                "number": 1,
                "name": "arr"
            }
        },

        "places": [{
            "placeId": "ChIJb3sWh27AwjsRkiAc5rqoVvs",
        }],
    }
    meta_photo_request = requests.post(metadata_upload_url, json=data, headers=headers)
    photoid = meta_photo_request.json()['photoId']['id']

要求等级2:

metadata_upload_url = "https://streetviewpublish.googleapis.com/v1/photo?key={}".format(API_KEY)
        headers = {"Authorization": "Bearer {}".format(ACCESS_KEY), "Content-Length": "0",
                   "Content-Type": "application/json"}
        data = {

            "uploadReference": {
                "uploadUrl": "https://streetviewpublish.googleapis.com/media/user/100547264652003378315/photo/5844140439745949662"
            },
            "pose": {
                "latLngPair": {
                    "latitude": 18.51315,
                    "longitude": 73.85671
                },
                # "altitude": 500,
                "heading": 0.0,
                "pitch": 0.0,
                "level": {
                    "number": 2,
                    "name": "brr"
                }
            },

            "places": [{
                "placeId": "ChIJb3sWh27AwjsRkiAc5rqoVvs",
            }],
        }
        meta_photo_request = requests.post(metadata_upload_url, json=data, headers=headers)
        photoid = meta_photo_request.json()['photoId']['id']  

状态为200的结果

{
  "results": [
    {
      "status": {
        "code": 200
      },
      "photo": {
        "photoId": {
          "id": "CAoSLEFGMVFpcE5UOXQzcDBwa0kwTGVROG81Nm1Qc05HdFo4djROUjB4YXM0UGNf"
        },
        "pose": {
          "latLngPair": {
            "latitude": 18.51315,
            "longitude": 73.856709999999993
          },
          "altitude": "NaN",
          "pitch": "NaN",
          "roll": "NaN",
          "level": {}
        },
        "connections": [
          {
            "target": {
              "id": "CAoSLEFGMVFpcE9VaEpXRU03SWZod0dkdFVJUDgwNHhsY0p2YWktcTVldHVmZ0ZV"
            }
          }
        ],
        "captureTime": "2017-07-27T00:00:00Z",
        "places": [
          {
            "placeId": "ChIJb3sWh27AwjsRkiAc5rqoVvs"
          }
        ],
        "thumbnailUrl": "https://lh3.googleusercontent.com/p/AF1QipNT9t3p0pkI0LeQ8o56mPsNGtZ8v4NR0xas4Pc_=-no",
        "viewCount": "7",
        "shareLink": "https://www.google.com/maps/@18.51315,73.85671,0a,75y/data=!3m6!1e1!3m4!1s-W7huarDveuA%2FWXnJ6zKkzAI%2FAAAAAAAAia8%2FhTVrH8aZO54yds7DERdBRcwHUvgzg_6BACLIBGAYYCw!2e4!3e11!6s%2F%2Flh3.googleusercontent.com%2F-W7huarDveuA%2FWXnJ6zKkzAI%2FAAAAAAAAia8%2FhTVrH8aZO54yds7DERdBRcwHUvgzg_6BACLIBGAYYCw%2Fno%2Fphoto.jpg"
      }
    },


    {
      "status": {
        "code": 200
      },
      "photo": {
        "photoId": {
          "id": "CAoSLEFGMVFpcE9VaEpXRU03SWZod0dkdFVJUDgwNHhsY0p2YWktcTVldHVmZ0ZV"
        },
        "pose": {
          "latLngPair": {
            "latitude": 18.51314,
            "longitude": 73.8567
          },
          "altitude": "NaN",
          "pitch": "NaN",
          "roll": "NaN",
          "level": {}
        },
        "connections": [
          {
            "target": {
              "id": "CAoSLEFGMVFpcE5UOXQzcDBwa0kwTGVROG81Nm1Qc05HdFo4djROUjB4YXM0UGNf"
            }
          }
        ],
        "captureTime": "2017-07-27T00:00:00Z",
        "places": [
          {
            "placeId": "ChIJb3sWh27AwjsRkiAc5rqoVvs"
          }
        ],
        "thumbnailUrl": "https://lh3.googleusercontent.com/p/AF1QipOUhJWEM7IfhwGdtUIP804xlcJvai-q5etufgFU=-no",
        "viewCount": "8",
        "shareLink": "https://www.google.com/maps/@18.51314,73.8567,0a,75y/data=!3m6!1e1!3m4!1s-huvo4fBlnjw%2FWXnJARb4q7I%2FAAAAAAAAia0%2FJDjPyYRA2L8S4n48xtakPUSglymSICRIACLIBGAYYCw!2e4!3e11!6s%2F%2Flh3.googleusercontent.com%2F-huvo4fBlnjw%2FWXnJARb4q7I%2FAAAAAAAAia0%2FJDjPyYRA2L8S4n48xtakPUSglymSICRIACLIBGAYYCw%2Fno%2Fphoto.jpg"
      }
    }
  ]
}  

在结果中,当我放置关卡名称和编号时,关卡对象为空。我不明白为什么它显示为空。

有人可以告诉我们在谷歌地图上发布多级拍摄需要遵循的步骤吗?

1 个答案:

答案 0 :(得分:0)

您需要确保所有照片彼此非常接近(约5米)才能显示水平控制。 您可以尝试通过单独的photo.update调用发送关卡数据。别忘了使用正确的updateMask。