【源码】Google地图嵌入MATLAB图片——plot_google​_map函数

在这里插入图片描述

plot_google_map函数的作用是使用Google Maps API在当前图片的背景中绘制指定的谷歌地图。该函数假定当前图形的坐标以WGS84为基准,并使用转换代码将图像从Google使用的坐标系转换并投影到WGS84坐标中。地图的缩放尺度经过自动确定以覆盖图形的整个区域,此外,还可以在图中缩放时自动刷新地图,在放大时显示更多细节。

谷歌地图API在没有API密钥的情况下每天最多只能提供1000个请求响应。如果您需要频繁使用此函数,最好申请一个API密钥。

function varargout =plot_google_map(varargin)

% function h = plot_google_map(varargin)

% Plots a google map on the current axesusing the Google Static Maps API

%

% USAGE:

% h = plot_google_map(Property, Value,…)

% Plots the map on the given axes. Usedalso if no output is specified

%

% Or:

% [lonVec latVec imag] =plot_google_map(Property, Value,…)

% Returns the map without plotting it

%

% PROPERTIES:

% Axis - Axis handle. Ifnot given, gca is used.

% Height (640) - Height of theimage in pixels (max 640)

% Width (640) - Width of the image in pixels (max 640)

% Scale (2) - (1/2) Resolutionscale factor. Using Scale=2 will

% double the resulotion ofthe downloaded image (up

% to 1280x1280) and will resultin finer rendering,

% but processing time willbe longer.

% Resize (1) - (recommended 1-2)Resolution upsampling factor.

% Increases image resolutionusing imresize(). This results

% in a finer image but itneeds the image processing

% toolbox and processingtime will be longer.

% MapType - (‘roadmap’) Typeof map to return. Any of [roadmap,

% satellite, terrain,hybrid]. See the Google Maps API for

% more information.

% Alpha (1) - (0-1)Transparency level of the map (0 is fully

% transparent). While themap is always moved to the

% bottom of the plot (i.e.will not hide previously

% drawn items), this can beuseful in order to increase

% readability if many colorsare plotted

% (using SCATTER forexample).

…………….

GitHub下载地址:

https://github.com/zoharby/plot_google_map

也可用以下地址下载:

http://page2.dfpan.com/fs/9lec2j82c2316259163/

更多精彩文章请关注微信号:在这里插入图片描述

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值