How can I export 360 degree image to Google Map Street View

635 Views Asked by At

How can I upload a 360 degree image to Google map street view. (I know to take 360 degree photo and upload from street view app).

1

There are 1 best solutions below

0
abielita On

You may follow this documentation on how to upload photos using curl.

Creating a photo requires three separate calls. The first call will return an upload URL, which is used in the second call to upload the photo bytes. After the photo bytes are uploaded, the third call uploads the metadata of the photo and returns the photo ID.

  1. Request an Upload URL

    $ curl --request POST \
    --url 'https://streetviewpublish.googleapis.com/v1/photo:startUpload?key=YOUR_API_KEY' \
    --header 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
    --header 'Content-Length: 0'
    
  2. Upload the photo bytes to the Upload URL

    $ curl --request POST \
    --url 'UPLOAD_URL' \
    --upload-file 'PATH_TO_FILE' \
    --header 'Authorization: Bearer YOUR_ACCESS_TOKEN'
    
  3. Upload the metadata of the photo

    $ curl --request POST \
    --url 'https://streetviewpublish.googleapis.com/v1/photo?key=YOUR_API_KEY' \
    --header 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
    --header 'Content-Type: application/json' \
    --data '{
              "uploadReference":
              {
                "uploadUrl": "UPLOAD_URL"
              },
              "pose":
               {
                 "heading": 105.0,
                 "latLngPair":
                 {
                   "latitude": 46.7512623,
                   "longitude": -121.9376983
                 }
              },
              "captureTime":
              {
                "seconds": 1483202694
              },
            }'
    

There are also client libraries available which you may use to avoid the need to manually set up HTTP requests and parse the responses.