Navigation is not working in proper direction using Street View Publish API

216 Views Asked by At

I'm using batchUpdate method for panos connection. I have an issue with connections. The navigation is not working in proper direction. Please suggest me where I'm wrong?

enter image description here

I have attached an image for my problem. I want to go north direction but here, arrow is showing in east direction. I'm not getting, Is this problem related to latitude or longitude or heading or pitch? Please help me.

This is my method for Upload the metadata of the photo :

def upload_image_metadata(upload_link, heading, pitch, latitude, longitude, place_id):
    global ACCESS_KEY
    ACCESS_KEY = get_access_key()
    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": upload_link
        },
        "pose": {
            "latLngPair": {
                "latitude": latitude,
                "longitude": longitude
            },
            "heading": heading,
            "pitch": pitch,
        },

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

There are 2 best solutions below

3
abielita On

As stated in this link, the direction of the arrow can be determined by the lat,lng and heading of each set of 2 panos which are linked.

From this thread,

You need to edit the heading of each photo that you want to connect. Example, for pano_1 with arrow pointing to right with heading:90, your pano_2 should have a heading:270. Be noted that you need to edit both pictures. (I've done this by trial and error.)

3
Harish Kumar On

Consider the following image

Connection between 4 panoramas

You can see in the above image There are four panos here. pano_1 is connected to pano_2 and pano_3. To make a perfect connection and correct arrow position you have to set heading first of pano_1 (Note: heading value sets a north position of a panorama. It will open the default view which we sets heading value for it). pano_2 is located at south of pano_1 so put the lat and lon towards south from pano_1 pano_3 is located at north of pano_1 put it at the lat and lon towards north from pano_1

Request JSON for this would be:

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

and pano_4 is at the east of pano_3. put it towards right/east side from pano_3 json request would be :

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