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
本文来源于:【源码】Google地图嵌入MATLAB图片——plot_google_map函数-变化吧门户
特别声明:以上文章内容仅代表作者本人观点,不代表变化吧门户观点或立场。如有关于作品内容、版权或其它问题请于作品发表后的30日内与变化吧联系。
- 赞助本站
- 微信扫一扫
-
- 加入Q群
- QQ扫一扫
-
评论