ofxStreetView icon indicating copy to clipboard operation
ofxStreetView copied to clipboard

Quality drop after error

Open fred-dev opened this issue 8 years ago • 6 comments

I am making repeated fast requests of new locations and eventually I will get this error

Request_url: http://cbk0.google.com/cbk?output=xml&ll=53.4113,-6.84177&dm=1 [ error ] ofxXmlSettings: pushTag(): tag "annotation_properties" not found Status: 200

It happens on different locations as well. After this error I can only get very low resolution images. The connection speed does not change.

fred-dev avatar Oct 30 '16 17:10 fred-dev

This is not an official API, and google usually don't like the scrapping of their data... they probably are blocking your request : )

patriciogonzalezvivo avatar Oct 30 '16 17:10 patriciogonzalezvivo

That makes sense, but I managed to do something very hacky and fix it, maybe it is another issue. When I get the error I run these two new methods then everything stays high quality.

streetview.deconstruct();
streetview.construct();
void ofxStreetView::deconstruct(){
    if(bRegister){
        ofUnregisterURLNotification(this);
        bRegister = false;
    }
}
void ofxStreetView::construct(){
    clear();
    maxDistance = 200;
    bRegister = false;
    bTexture = true;
    mapWidth = 512;
    mapHeight = 256;
    num_zoom_levels = 3;
    zoom = 3;
}

fred-dev avatar Oct 31 '16 20:10 fred-dev

wow cool! So probably is not that? In any case. If is working for you do you mind making a PR?

patriciogonzalezvivo avatar Oct 31 '16 20:10 patriciogonzalezvivo

Sure, will do, I want to check if the "annotation_properties" not found is a symptom or cause of the error, and clean up the method for checking it. Once I am done Ill make a PR.

fred-dev avatar Oct 31 '16 20:10 fred-dev

@fred-dev Where did you add these calls to catch the error?

Normally response.data contains something like

<?xml version="1.0" encoding="UTF-8" ?><panorama><data_properties image_width="13312" image_height="6656" ...

But sometimes it's just

<?xml version="1.0" encoding="UTF-8" ?><panorama/>

which leads to the error:

 [ error ] ofxXmlSettings: pushTag(): tag "annotation_properties" not found

I tried random locations until I got the error, then I ran the script multiple times with that location and I received the same error every time, leading me to think there is no depth data at that specific location which will always result in an error. A good point to check for problems could be when retrieving depth_map_base64 but I'm not completely sure what would be a logical next step: stop getting the data and set some flag?

depth_map_base64 = XML.getValue("panorama:model:depth_map", "");
hasData = true;  
if(depth_map_base64 == ""){
    hasData = false;
    return;
}
...
// check for data before drawing?
if (streetview.hasData){
    streetview.draw();
}

javl avatar Feb 07 '17 11:02 javl

I never made a neat solution, I called construct and deconstruct every time I wanted to load a new sphere and it kept the resolution high.

fred-dev avatar Feb 11 '17 14:02 fred-dev