Changeset 15160
- Timestamp:
- 05/30/13 10:00:20 (12 years ago)
- Location:
- issm/trunk-jpl/src/m/plot
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/m/plot/googlemaps.m
r15155 r15160 48 48 end 49 49 50 %Get region specific projection parameters 51 EPSGgoogle = 'EPSG:3785'; % Mercator http://www.spatialreference.org/ref/epsg/3785/ 52 if strcmpi(md.mesh.hemisphere,'n'), 53 EPSGlocal = 'EPSG:3413'; % UPS Greenland http://www.spatialreference.org/ref/epsg/3413/ 54 elseif strcmpi(md.mesh.hemisphere,'s'), 55 EPSGlocal = 'EPSG:3031'; % UPS Antarctica http://www.spatialreference.org/ref/epsg/3031/ 56 else 57 error('field hemisphere should either be ''n'' or ''s'''); 58 end 59 50 60 %Find optimal zoom 51 61 if exist(options,'zoom'), … … 85 95 position = [num2str(latn) ',' num2str(lonn)]; 86 96 disp(['Google Earth tile: ' num2str(x) '/' num2str(cols-1) ' ' num2str(y) '/' num2str(rows-1) ' (center: ' position ')']); 87 %Google maps API 88 %http://developers.google.com/maps/documentation/staticmaps/ 97 %Google maps API: http://developers.google.com/maps/documentation/staticmaps/ 89 98 params = [... 90 99 'center=' position ... … … 105 114 end 106 115 107 %Create coordinates grids 108 [gX gY]=meshgrid(ulx:ulx+size(final,2)-1,uly:-1:uly-size(final,1)+1); 109 [LAT LON]=pixelstolatlon(gX,gY, zoom); 110 if strcmpi(md.mesh.hemisphere,'n'), 111 [X Y]=ll2xy(LAT,LON,+1,45,70); 112 elseif strcmpi(md.mesh.hemisphere,'s'), 113 [X Y]=ll2xy(LAT,LON,-1,0,71); 114 else 115 error('field hemisphere should either be ''n'' or ''s'''); 116 end 116 %Write image, create geotiff and reproject from mercator to local projection 117 imwrite(final,'temp.png','png') 118 [ulmx ulmy]=ll2mercator(ullat,ullon); 119 [lrmx lrmy]=ll2mercator(lrlat,lrlon); 120 121 %Create Geotiff for Mercator projection 122 system(['gdal_translate -of Gtiff -co "tfw=yes" -a_ullr '... 123 num2str(ulmx,'%15.8f') ' ' num2str(ulmy,'%15.8f') ' ' num2str(lrmx,'%15.8f') ' ' num2str(lrmy,'%15.8f')... 124 ' -a_srs "' EPSGgoogle '" "temp.png" "temp.tiff"']); 125 delete('temp.png'); 126 127 %reproject from mercator (EPSG:3785) to UPS Ant (EPSG:3031) 128 system(['gdalwarp -s_srs ' EPSGgoogle ' -t_srs ' EPSGlocal ' temp.tiff temp2.tiff']); 129 delete('temp.tiff','temp.tfw'); 130 131 %Put everything in model 132 [status output]=system('gdalinfo temp2.tiff | grep "Upper Left"'); 133 ul = sscanf(output,'Upper Left (%f, %f)'); 134 [status output]=system('gdalinfo temp2.tiff | grep "Lower Right"'); 135 lr = sscanf(output,'Lower Right (%f, %f)'); 136 [status output]=system('gdalinfo temp2.tiff | grep "Size is"'); 137 si = sscanf(output,'Size is %i, %i'); 138 x_m=linspace(ul(1),lr(1),si(1)); 139 y_m=linspace(ul(2),lr(2),si(2)); %We need to reverse y_m because the image is read upside down by matlab 140 final=imread('temp2.tiff'); 141 delete('temp2.tiff'); 117 142 118 143 md.radaroverlay.pwr=final; 119 md.radaroverlay.x= X;120 md.radaroverlay.y= Y;144 md.radaroverlay.x=x_m; 145 md.radaroverlay.y=y_m; 121 146 122 147 end -
issm/trunk-jpl/src/m/plot/plot_googlemaps.m
r15155 r15160 47 47 48 48 %Retrieve image from md 49 X = md.radaroverlay.x; 50 Y = md.radaroverlay.y; 51 final = md.radaroverlay.pwr; 49 [X Y] = meshgrid(md.radaroverlay.x,md.radaroverlay.y); 50 final = double(md.radaroverlay.pwr)/double(max(md.radaroverlay.pwr(:))); %rescale between 0 and 1 52 51 53 52 %Get some options
Note:
See TracChangeset
for help on using the changeset viewer.