Street view publish api pose.level won't save

136 Views Asked by At

I'm trying to post photo.pose.level on existing photo using Street View Publish API.

When i post GPS, HEADING and LEVEL data, first two (GPS+HEADING) are stored on street view photo, but LEVEL data is lost and won't save (server response is OK).

Here is my POST code that works for HEADING and GPS, i can't figure out where i'm wrong or if i'm missing something.. i think i've done all as described in documentation

    $data['pose']['latLngPair']['latitude']=$lat+0;
    $data['pose']['latLngPair']['longitude']=$lon+0;
    $data['pose']['heading']=$heading+0;
    $data['pose']['level']['number']=$level+0;
    $data['pose']['level']['name']='L'.($level+0).'';
    $data_string = json_encode($data);  

    $ch = curl_init('https://streetviewpublish.googleapis.com/v1/photo/'.$photo_id.'?key='.$_GOOGLE_API['api_key'].'&updateMask=pose.latLngPair,pose.heading,pose.level');                                                                      
    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);
1

There are 1 best solutions below

1
Thomas On

Looks good. How long did you wait? Sometimes it takes up to 24hrs before the data shows up in the getPhoto requests.