Method: photo.create
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
客户端使用返回的 UploadRef
上传照片后,photo.create
会将上传的 Photo
发布到 Google 地图上的街景。
目前,在 photo.create 中设置航向、俯仰角和滚动角的唯一方法是通过照片字节中的 Photo Sphere XMP 元数据。photo.create 会忽略 Pose 中的 pose.heading
、pose.pitch
、pose.roll
、pose.altitude
和 pose.level
字段。
此方法会返回以下错误代码:
HTTP 请求
POST https://streetviewpublish.googleapis.com/v1/photo
网址采用 gRPC 转码语法。
响应正文
如果成功,响应正文将包含一个新创建的 Photo
实例。
授权范围
需要以下 OAuth 范围:
https://www.googleapis.com/auth/streetviewpublish
如需了解详情,请参阅 OAuth 2.0 概览。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-25。
[null,null,["最后更新时间 (UTC):2025-07-25。"],[[["\u003cp\u003e\u003ccode\u003ephoto.create\u003c/code\u003e publishes a 360 photo to Street View on Google Maps after it's been uploaded using an UploadRef.\u003c/p\u003e\n"],["\u003cp\u003eCurrently, heading, pitch, and roll can only be set through Photo Sphere XMP metadata within the photo itself.\u003c/p\u003e\n"],["\u003cp\u003eThis method may return errors if the request is malformed, photo isn't 360, upload reference is invalid, or storage limit is reached.\u003c/p\u003e\n"],["\u003cp\u003eRequires \u003ccode\u003ehttps://www.googleapis.com/auth/streetviewpublish\u003c/code\u003e OAuth scope for authorization.\u003c/p\u003e\n"],["\u003cp\u003eUses a POST request to \u003ccode\u003ehttps://streetviewpublish.googleapis.com/v1/photo\u003c/code\u003e with the Photo details in the request body.\u003c/p\u003e\n"]]],["Clients upload a photo using `UploadRef`, then use `photo.create` to publish the `Photo` to Google Maps. Heading, pitch, and roll must be set in the Photo Sphere XMP metadata. The request URL is `POST https://streetviewpublish.googleapis.com/v1/photo`. The request body includes a `Photo` instance, and a successful response returns a created `Photo` instance. It requires the `streetviewpublish` OAuth scope and can return `INVALID_ARGUMENT`, `NOT_FOUND`, or `RESOURCE_EXHAUSTED` error codes.\n"],null,["# Method: photo.create\n\n- [HTTP request](#body.HTTP_TEMPLATE)\n- [Request body](#body.request_body)\n- [Response body](#body.response_body)\n- [Authorization scopes](#body.aspect)\n- [Try it!](#try-it)\n\nAfter the client finishes uploading the photo with the returned [UploadRef](/streetview/publish/reference/rest/v1/photo#UploadRef), [photo.create](/streetview/publish/reference/rest/v1/photo/create#google.streetview.publish.v1.StreetViewPublishService.CreatePhoto) publishes the uploaded [Photo](/streetview/publish/reference/rest/v1/photo#Photo) to Street View on Google Maps.\n\nCurrently, the only way to set heading, pitch, and roll in photo.create is through the [Photo Sphere XMP metadata](https://developers.google.com/streetview/spherical-metadata) in the photo bytes. photo.create ignores the `pose.heading`, `pose.pitch`, `pose.roll`, `pose.altitude`, and `pose.level` fields in Pose.\n\nThis method returns the following error codes:\n\n- [google.rpc.Code.INVALID_ARGUMENT](/streetview/publish/reference/rest/v1/Code#ENUM_VALUES.INVALID_ARGUMENT) if the request is malformed or if the uploaded photo is not a 360 photo.\n- [google.rpc.Code.NOT_FOUND](/streetview/publish/reference/rest/v1/Code#ENUM_VALUES.NOT_FOUND) if the upload reference does not exist.\n- [google.rpc.Code.RESOURCE_EXHAUSTED](/streetview/publish/reference/rest/v1/Code#ENUM_VALUES.RESOURCE_EXHAUSTED) if the account has reached the storage limit.\n\n### HTTP request\n\n`POST https://streetviewpublish.googleapis.com/v1/photo`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Request body\n\nThe request body contains an instance of [Photo](/streetview/publish/reference/rest/v1/photo#Photo).\n\n### Response body\n\nIf successful, the response body contains a newly created instance of [Photo](/streetview/publish/reference/rest/v1/photo#Photo).\n\n### Authorization scopes\n\nRequires the following OAuth scope:\n\n- `https://www.googleapis.com/auth/streetviewpublish`\n\nFor more information, see the [OAuth 2.0 Overview](https://developers.google.com/identity/protocols/OAuth2)."]]