使用街景发布 API 上传带有航向和 GPS 的全景图像将无法正常工作

Upload pano image with heading and gps using street View Publish API won't work

我正在尝试使用 Publish Api 在街景中上传球形图像。 上传图像数据和位置关联效果很好,但每当我尝试将航向和 gps 位置数据上传到图像服务器时都会响应 "OK",但没有航向或位置与图像相关联。

这是我上传信息最后一步使用的php代码,我真的不知道我哪里错了。

$data['uploadReference']['uploadUrl']=$upload_url;
$data['pose']['heading']=$heading_north;      
$data['pose']['latLngPair']=$latLngPair;    
$data['captureTime']['seconds']=time();    
$data['places']['placeId']=$placeid; 

$data_string = json_encode($data); 


$ch = curl_init('https://streetviewpublish.googleapis.com/v1/photo?key='.$_GOOGLE_API['api_key']);

curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");                             
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);     
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);  
curl_setopt($ch, CURLOPT_HTTPHEADER, array(                                     
  'authorization: Bearer '.$_GOOGLE_API['access_token'],
  'Content-Type: application/json',                                             
  'Content-Length: ' . strlen($data_string))                                     
);                                                                                                                   
$result = curl_exec($ch);

curl_close ($ch);

编辑:

我已经按照建议实施了第二步,但没有任何变化.. Curl 响应仍然不包含任何错误..

$ch = curl_init('https://streetviewpublish.googleapis.com/v1/photo/'.$photo_id.'?key='.$_GOOGLE_API['api_key'].'&updateMask=pose.heading');                                                                      
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");                                                                     
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);  
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);                                                                      
curl_setopt($ch, CURLOPT_HTTPHEADER, array(                                                                          
        'authorization: Bearer '.$_GOOGLE_API['access_token'],
        'Content-Type: application/json',                                                                                
        'Content-Length: ' . strlen($data_string))                                                                       
    );                                                                                                                                                                                                                                   
$json_response=curl_exec($ch);
curl_close ($ch);
echo $json_response;

EDIT2:此过程有效,但 google api 很慢,编辑后的数据将在几分钟内显示..

EDIT3(已解决):GET photos(列表)有一些 chache 问题。要获得刚刚更新的正确值,您需要请求 GET photo (single) 以强制进行有效的缓存更新。

尝试使用 photo.update 在第二步中设置值。不要忘记为值设置 updateMask。