Changeset 15172


Ignore:
Timestamp:
05/30/13 11:33:15 (12 years ago)
Author:
Mathieu Morlighem
Message:

CHG: if gdal is not installed

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

Legend:

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

    r15160 r15172  
    114114end
    115115
    116 %Write image, create geotiff and reproject from mercator to local projection
     116%Write image
    117117imwrite(final,'temp.png','png')
    118118[ulmx ulmy]=ll2mercator(ullat,ullon);
     
    120120
    121121%Create Geotiff for Mercator projection
    122 system(['gdal_translate -of Gtiff -co "tfw=yes"  -a_ullr '...
     122[status,result] = system(['gdal_translate -of Gtiff -co "tfw=yes"  -a_ullr '...
    123123        num2str(ulmx,'%15.8f') ' ' num2str(ulmy,'%15.8f') ' ' num2str(lrmx,'%15.8f') ' ' num2str(lrmy,'%15.8f')...
    124124        ' -a_srs "' EPSGgoogle '" "temp.png" "temp.tiff"']);
    125125delete('temp.png');
     126
     127%If not gdal, exit
     128if status~=0,
     129        disp('googlemaps info: gdal not found or not working properly, the Google image will not be transformed');
     130        [gX gY]=meshgrid(ulx:ulx+size(final,2)-1,uly:-1:uly-size(final,1)+1);
     131        [LAT LON]=pixelstolatlon(gX,gY, zoom);
     132        if strcmpi(md.mesh.hemisphere,'n'),
     133                [X Y]=ll2xy(LAT,LON,+1,45,70);
     134        elseif strcmpi(md.mesh.hemisphere,'s'),
     135                [X Y]=ll2xy(LAT,LON,-1,0,71);
     136        else
     137                error('field hemisphere should either be ''n'' or ''s''');
     138        end
     139        md.radaroverlay.pwr=final;
     140        md.radaroverlay.x=X;
     141        md.radaroverlay.y=Y;
     142        return
     143end
    126144
    127145%reproject from mercator (EPSG:3785) to UPS Ant (EPSG:3031)
  • issm/trunk-jpl/src/m/plot/plot_googlemaps.m

    r15169 r15172  
    6363                        data,xmin,ymax,xspacing,yspacing,nlines,ncols,NaN);
    6464else
    65         [X Y] = meshgrid(md.radaroverlay.x,md.radaroverlay.y);
     65        X = md.radaroverlay.x;
     66        Y = md.radaroverlay.y;
    6667        data_grid=InterpFromMeshToMesh2d(md.mesh.elements,md.mesh.x,md.mesh.y,data,X(:),Y(:),'default',NaN); data_grid=reshape(data_grid,size(X));
    6768        x_m=X(1,:); y_m=Y(:,1);
Note: See TracChangeset for help on using the changeset viewer.