function export_geotif(filename,ref)
%EXPORT_GEOTIF - export geotiff 
%
%
% Usage: export_geotif('Articles/figures/figure','EPSG:3411');
%


	%first export the figure
	export_fig([filename '.jpg']);

	%call gdal on this: 
	system(sprintf('gdal_translate -a_srs %s -of GTiff -co "INTERLEAVE=PIXEL" -a_ullr %g %g %g %g %s.jpg %s.tif', ref, min(xlim), max(ylim),max(xlim),min(ylim),filename,filename));
	system(['rm -rf ' filename '.jpg']);

end
