Method: photo.create
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Sau khi khách hàng tải ảnh lên với UploadRef
được trả về, photo.create
sẽ xuất bản Photo
đã tải lên Chế độ xem đường phố trên Google Maps.
Hiện tại, cách duy nhất để đặt hướng, độ nghiêng và độ nghiêng trong photo.create là thông qua siêu dữ liệu XMP của Ảnh toàn cảnh 360 độ trong các byte ảnh. photo.create bỏ qua các trường pose.heading
, pose.pitch
, pose.roll
, pose.altitude
và pose.level
trong Pose.
Phương thức này trả về các mã lỗi sau:
Yêu cầu HTTP
POST https://streetviewpublish.googleapis.com/v1/photo
URL sử dụng cú pháp Chuyển mã gRPC.
Nội dung yêu cầu
Nội dung yêu cầu chứa một bản sao của Photo
.
Nội dung phản hồi
Nếu thành công, nội dung phản hồi sẽ chứa một thực thể mới tạo của Photo
.
Phạm vi uỷ quyền
Yêu cầu phạm vi OAuth sau:
https://www.googleapis.com/auth/streetviewpublish
Để biết thêm thông tin, hãy xem bài viết Tổng quan về OAuth 2.0.
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2025-07-25 UTC.
[null,null,["Cập nhật lần gần đây nhất: 2025-07-25 UTC."],[[["\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)."]]