1

I'm using photo.update request for panos(360 panoramic images) connection in python. I'm able to do only connect one pano to another pano but I want to connect one pano to multiple panos. I'm not getting a successful result.

I have sent the following photoUpdate request using Python:

update_photo_url = 'https://streetviewpublish.googleapis.com/v1/photo/{}?key={}&updateMask=connections'.format("pano_1","AIzdesdfyxscvvvvvvvvvvvvvvv")

headers = {"Authorization": "Bearer {}".format("ya29.Glx6BO91jWbjzLQKYPvP16fhT-jyOEnIdnoRcZcU9uYCqzwH3Dkuf-qf_kzUc2ykYOyVTZCfaGjOEAScsJK7WgS4NE9gfS6bSobWDIMdfpfY7SPzRMmxi4kfTrmsRQ"), "Content-Length": "0", "Content-Type": "application/json"}

update_body = {
[
{
"photo": {
  "photoId": {
    "id": "pano_1"
  },
  "connections": {
    "target": {
      "id": "pano_2"
    },
    "target": {
      "id": "pano_3"
    }
  },
}
}
]
}
update_response = requests.put(update_photo_url,headers=headers,json=update_body)
update_response.text  

Error:

{
    "error": {
        "code": 400,
        "message": "Invalid JSON payload received. Unknown name \"\": Root element must be a message.",
        "status": "INVALID_ARGUMENT",
        "details": [
            {
                "@type": "type.googleapis.com/google.rpc.BadRequest",
                "fieldViolations": [
                    {
                        "description": "Invalid JSON payload received. Unknown name \"\": Root element must be a message."
                    }
                ]
            }
        ]
    }
}  

Anyone know about, How to connect multiple 360 panos from the source pano? It would be really great if someone could clarify on the possibility of it.Thanks in advance.

Menu
  • 677
  • 1
  • 12
  • 30

1 Answers1

6

I've seen that your request URL is:

https://streetviewpublish.googleapis.com/v1/photo/{}?key={}&updateMask=connections'.format("pano_1","AIzdesdfyxscvvvvvvvvvvvvvvv")

In order to connect multiple photos, you need to use the batchUpdate method.

HTTP request

POST https://streetviewpublish.googleapis.com/v1/photos:batchUpdate?

Here's a sample request using curl:

curl --request POST \
    --url 'https://streetviewpublish.googleapis.com/v1/photos:batchUpdate' \
    --header 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
     --header 'Content-Type: application/json' \
     --data '{
              "updatePhotoRequests": [
            {
            "updateMask": "connections",
               "photo": {
                "photoId": {
                   "id": "pano_1"
                },
                "connections": [
                   {
                       "target": {
                        "id": "pano_2"
                         }
                           },
                           {
                       "target": {
                        "id": "pano_3"
                             }
                           }
                        ]
                        }
                   }
                ]
              }'

Update: If I have four panos and I want to connect pano_1 -> pano_2, pano_3 and pano_3 -> pano_4 then what will be the json format?

You should make pano_4 as your target to be connected to pano_3.

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

Just be noted that the id should be photoId of the uploaded photo.

abielita
  • 13,147
  • 2
  • 17
  • 59
  • Hey @abielita, If I have four panos and I want to connect pano_1 -> pano_2, pano_3 and pano_3 -> pano_4 then what will be the json format? – Menu Jul 04 '17 at 09:16
  • Is my json format is correct or not? Please check this link https://jsonblob.com/da14ee1c-60ae-11e7-ae4c-7504bfba11cf – Menu Jul 04 '17 at 11:51
  • Yes. That's also the json format I tried and it works. – abielita Jul 04 '17 at 12:04
  • According to your answer, If we have 3 panos and I connect pano_1 to pano_2 and pano_3 so connections are happening between 2 -> 1, 1 -> 3 and 3 -> 1 but connection is not showing betwwen 1 ->2. Can I know what is the issue? – Menu Jul 04 '17 at 12:09
  • I've tried on my end and it connects properly. Connections are showing between 1->2, 1->3, 2->1, 2->3, 3->1 and 3->2. I've also read in this [documentation](https://support.google.com/maps/answer/7011737?hl=en) that sometimes, there is a delay on making the connections and usually it takes 24 hours to connect. – abielita Jul 04 '17 at 12:51
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/148329/discussion-between-abielita-and-aruna-rajput). – abielita Jul 04 '17 at 14:00
  • Yeah sure, I have explained my query in chat – Menu Jul 04 '17 at 14:26
  • 1
    You may try to make a request using pano_2 as the base and pano_1 as target connection. Also, you can verify the connections using GET. The response will have a list of your photos along with their respective connections. Be noted that if the published panorama photos have the same lat,lng, the service that connects the photos might be excluding some links as they will be overlapping. What is the pose (heading, latitude, longitude) of your panos? – abielita Jul 06 '17 at 11:40
  • If I make a request using pano_2 as the base and pano_1 as target connection then There is no issue. If I make a request using pano_2 as the base and pano_1 and pano_3 as target connections then in this case one connection(2->1) is missing. I have also checked photo GET method. In the response, I'm getting all the panos with their respective connections but on the Google map some connection is missing. This is my issue and Always the latitude and longtude of the all panos will be same to a particular place then how to remove overlapping issue? – Menu Jul 06 '17 at 20:03
  • How to solve my problem? Do you have answer of my above query? – Menu Jul 10 '17 at 06:12