MATLAB Answers

Figures with large amounts of topographic data don't export properly to .eps (Version 2 using geoshow)

2 views (last 30 days)
Darcy on 12 Jun 2019
I am trying to plot a map with a very large amount of topographic data and other geographic information using geoshow and then save the figure as an EPS vector graphic. When I try to do this, the EPS is saved as a non-vector image. I have tried changing the renderer to "Painters", but this results in a 14 MB EPS file which crashes Adobe Illustrator when I try to open it and also takes about one minute to run on MATLAB.
Now, I don't really need the topography portion of the image to be vectorized. All I need is the other geographic information to be vector (e.g. roads, rivers, political boundaries, scale bar, etc.). I have currently used a work around in which I create one map with the topography data and save as a non-vector EPS figure and then create a second map with all the other geographic information and save as EPS. I then combine them manually in Illustrator. This is a somewhat tedious work-around for me, but it works. However, now I am trying to make the script more user-friendly to allow for it to be shared with some of my colleagues. I would like to avoid this tedious work-around.
Is there any way to "flatten" the topography portion of the image prior to saving as an EPS vector graphic so that each topography bins are not saved as an individual vector but the rest of the image is?
Any help is appreciated.
I am using MATLAB 2016a on Windows 7.
Below is a code sample and the topography matrix is attached.
%Set up map limits and labels
dlon = 2; dlat = 2; prec = 0;
ax = axesm('MapProjection','mercator','grid','on', ...
'frame', 'on','maplonlimit',[-123 -108],'maplatlimit',[47 61],'mlabellocation',dlon,'plabellocation',dlat,'mlinelocation',dlon,'plinelocation',dlat,'mlabelround',prec,'plabelround',prec);
scaleruler on
demcmap([-4000 5000]);
%Load topography, site locations, political boundaries, and city locations
load('topography.mat'); %See attached
load('locations.mat'); %See attached
%load('political_boundaries.mat'); Too large to upload for this question
cities = [53.537853 -113.472248; 51.0425 -114.0609; 49.1786 -122.5137];
%Plot topography
inc = 1; %Make this 1 to plot full resolution topography (but then EPS will not be vectorized)
%If you change this to 10 or 20, then the resolution is terrible but
%the EPS will be vector
[LON,LAT] = meshgrid(lon(1:inc:end),lat(1:inc:end));
geoshow(LAT,LON,topo_z(1:inc:end,1:inc:end),'displaytype','texturemap'); hold on
%Plot other geographic information
plotm(cities(:,1),cities(:,2),'*k','MarkerSize',15); hold on
%for i = 1:length(CA)
% plotm(CA(i).Y(1:end),CA(i).X(1:end),'-k','LineWidth',1); hold on
set(gcf,'renderer','Painters'); %Results in a huge EPS file and takes very long to run

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!