source: issm/oecreview/Archive/14312-15392/ISSM-15205-15206.diff

Last change on this file was 15393, checked in by Mathieu Morlighem, 12 years ago

NEW: adding Archive/14312-15392 for oecreview

File size: 1.8 KB
  • ../trunk-jpl/src/m/plot/googlemaps.m

     
    8080rows = ceil(dy/maxsize);
    8181
    8282%calculate pixel dimensions of each small image
    83 bottom = 120;
    84 largura = ceil(dx/cols);
    85 altura  = ceil(dy/rows);
    86 alturaplus = altura + bottom;
     83bottom = 100;
     84width  = ceil(dx/cols);
     85height  = ceil(dy/rows);
     86heightplus = height + bottom;
    8787
    8888%Initialize final image
    8989final = zeros(floor(dy),floor(dx),3);%RGB image
    9090for x=0:cols-1,
    9191        for y=0:rows-1,
    92                 dxn = largura * (0.5 + x);
    93                 dyn = altura * (0.5 + y);
     92                dxn = width * (0.5 + x);
     93                dyn = height * (0.5 + y);
    9494                [latn, lonn] = pixelstolatlon(ulx + dxn, uly - dyn - bottom/2, zoom);
    9595                position = [num2str(latn) ',' num2str(lonn)];
    9696                disp(['Google Earth tile: ' num2str(x) '/' num2str(cols-1) ' ' num2str(y) '/' num2str(rows-1) ' (center: ' position ')']);
     
    9898                params = [...
    9999                        'center=' position ...
    100100                        '&zoom=' num2str(zoom)...
    101                         '&size=' num2str(largura) 'x' num2str(alturaplus)...
     101                        '&size=' num2str(width) 'x' num2str(heightplus)...
    102102                        '&maptype=satellite'...
    103103                        '&sensor=false'...
    104104                        '&scale=' num2str(scale)];
    105105                url = ['http://maps.google.com/maps/api/staticmap?' params];
    106106                [X, map]=imread(url,'png');
    107107                X=ind2rgb(X,map);
    108                 indx1 = floor(x*largura)+1;
    109                 indx2 = min(floor(dx),floor(x*largura)+size(X,2));
    110                 indy1 = floor(y*altura)+1;
    111                 indy2 = min(floor(dy),floor(y*altura)+size(X,1));
     108                indx1 = floor(x*width)+1;
     109                indx2 = min(floor(dx),floor(x*width)+size(X,2));
     110                indy1 = floor(y*height)+1;
     111                [floor(dy),floor(y*height)+size(X,1)]
     112                [height heightplus]
     113                indy2 = min(floor(dy),floor(y*height)+size(X,1));
    112114                final(indy1:indy2,indx1:indx2,:)=X(1:indy2-indy1+1,1:indx2-indx1+1,:);
    113115        end
    114116end
Note: See TracBrowser for help on using the repository browser.