Changeset 23332


Ignore:
Timestamp:
09/24/18 10:23:15 (6 years ago)
Author:
Mathieu Morlighem
Message:

CHG: multiple tries for Google maps

Location:
issm/trunk-jpl/src/m/plot
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/m/plot/applyoptions.m

    r23089 r23332  
    142142        if exist(options,'colorbarcornerposition'),
    143143                c=colorbar(getfieldvalue(options,'colorbarcornerposition'),'peer',gca);
     144        elseif exist(options,'colorbarpos') & ischar(getfieldvalue(options,'colorbarpos')),
     145                c=colorbar(getfieldvalue(options,'colorbarpos'));
    144146        else
    145147                c=colorbar('peer',gca);
     
    151153                set(c,'Ylim',lim);
    152154        end
    153         if exist(options,'colorbarpos'),
     155        if exist(options,'colorbarpos') & isnumeric(getfieldvalue(options,'colorbarpos')),
    154156                set(c,'Position',getfieldvalue(options,'colorbarpos'));
    155157        end
  • issm/trunk-jpl/src/m/plot/googlemaps.m

    r22259 r23332  
    123123                        '&scale=' num2str(scale)];
    124124                url = ['http://maps.google.com/maps/api/staticmap?' params];
    125                 [X, map]=imread(url,'png');
     125                count = 0;
     126                countmax = 10;
     127                while(true)
     128                        try,
     129                                [X, map]=imread(url,'png');
     130                                break;
     131                        catch me,
     132                                count = count+1;
     133                                disp('Failed, trying again... (' num2str(countmax-count) ' more attempts)');
     134                                pause(.3);
     135                                if count>countmax,
     136                                        disp('Giving up...');
     137                                        rethrow(me);
     138                                end
     139                        end
     140                end
    126141                X=ind2rgb(X,map);
    127142                indx1 = floor(x*width)+1;
Note: See TracChangeset for help on using the changeset viewer.