使用街景发布 API 上传带有标题和 GPS 的全景图像不起作用



我正在尝试使用Publish API在街道上上传球形图像。图像数据和地点协会的上传效果很好,但是每当我尝试将标题和GPS位置数据上传到图像服务器时,响应"确定",但是与图像无关。

这是我用于上传的最后一步的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);

编辑:

我已经实施了第二步,但没有任何变化。卷曲响应仍然没有任何错误。

$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(已解决):获取照片(列表)有一些chache问题。要获取正确的值,您需要请求获取照片(单个)以强制有效的缓存更新。

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

最新更新