Skip to content

Commit

Permalink
Merge pull request #1 from cbcunc/master
Browse files Browse the repository at this point in the history
Use a proper temp file.
  • Loading branch information
zoharby committed Oct 18, 2015
2 parents 14b7d12 + 8c4bfbd commit 07f72be
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions plot_google_map.m
Original file line number Diff line number Diff line change
Expand Up @@ -346,8 +346,9 @@
url = [preamble location zoomStr sizeStr maptypeStr format markers labelsStr languageStr sensor keyStr];

% Get the image
filepath = fullfile(tempdir, filename);
try
urlwrite(url,filename);
urlwrite(url,filepath);
catch % error downloading map
warning(sprintf(['Unable to download map form Google Servers.\n' ...
'Possible reasons: no network connection, quota exceeded, or some other error.\n' ...
Expand All @@ -358,9 +359,9 @@
varargout{3} = [];
return
end
[M Mcolor] = imread(filename);
[M Mcolor] = imread(filepath);
M = cast(M,'double');
delete(filename); % delete temp file
delete(filepath); % delete temp file
width = size(M,2);
height = size(M,1);

Expand Down Expand Up @@ -568,5 +569,3 @@ function update_google_map_fig(obj,evd)
plot_google_map(params{:});
end
end


0 comments on commit 07f72be

Please sign in to comment.