中国区域地图叠加绘制
中国区域地图叠加绘制
- 1、数据准备
- 2、相关Matlab代码及使用方法
- 3、图片固定位置信息标注
- drawmap更新
1、数据准备
地理信息地图在进行绘制的过程中,叠加上行政区域,更方便进行位置定位,更有利于针对问题进行具体分析。
本文提供了两个Matlab函数,方便在画图时进行行政区域地图叠加操作。
中国区域各种行政划分河流数据等shp文件,请自行下载,百度云链接https://pan.baidu.com/s/1wT4L5uvQRFdHyiaK5-_SXA 提取码:yxcz
2、相关Matlab代码及使用方法
叠加中国区域行政地图的函数如下:
将下边函数复制,加载到matlab环境中,在需要进行叠加行政地图的区域使用drawmap(‘省’)即可完成行政区域的叠加操作,结果如下图所示。
function drawmap(Province, varargin)% drawmap: Add administrative region information for a specified province on the canvas
% use whith default configuration --> drawmap('湖北省')
% use whithout global map --> drawmap('湖北省', 'global', 0)% ------------------------------------------------------------ %
% Author: Muyeqingfeng
% e-mail address: muyeqingfeng@126.com
% Release date: 2023/05/05ip = inputParser;
ip.addParamValue('global', 1);
parse(ip,varargin{:}); % decoding the shp file wiht GBK
feature('DefaultCharacterSet', 'GBK');
path = 'shp_path';
China1=shaperead([path,'省.shp']);
China2=shaperead([path,'市.shp']);idx1 = 0;
idx2 = [];
% Provincial boundary infomation
for i=1:length(China1)if strcmp(China1(i).x0xCA0xA1,Province), idx1=i;end
end
% Market boundary information
for j=1:length(China2)if strcmp(China2(j).x0xCA0xA1,Province), idx2=[idx2,j];end
endif ip.Results.global == 1% the whole china infoplot([China1(:).X],[China1(:).Y],'color',[0.2 0.2 0.2],'linewidth',1.0); hold on
end
% the special Province
plot([China1(idx1).X],[China1(idx1).Y],'color','r','linewidth',1.5); hold on
% all of the city of the special Province
plot([China2(idx2).X],[China2(idx2).Y],'color','k','linewidth',0.8); hold on
set(gca,'Layer','top');
end
函数调用结果展示
figure;drawmap('湖北省')
figure;drawmap('湖北省','global', 0)
3、图片固定位置信息标注
以下提供了一个函数,在绘制图像时,在图像固定比例处进行信息标注,使得图像信息显得整齐一致
function text_info(varargin)
% text_info: Print information in a fixed position on the image
% use with the default configuration ---> text_info('text', 'the info need to print')
% change the position the display the info ---> text_into('xi', 0.1, 'yi', 0.2)
% change the color/fontsize of the display the info ---> text_into('color', 'r', 'ftsiz', 20)% ------------------------------------------------------------ %
% Author: Muyeqingfeng
% e-mail address: muyeqingfeng@126.com
% Release date: 2023/05/05ip = inputParser;
ip.addParamValue('xi', 0.1);
ip.addParamValue('yi', 0.1);
ip.addParamValue('text', 'test');
ip.addParamValue('ftsiz', 30);
ip.addParamValue('color', 'k');
parse(ip,varargin{:}); hh=get(gca);
X=hh.XLim;
Y=hh.YLim;
k3=[ip.Results.xi ip.Results.yi];
x_3=X(1)+k3(1)*(X(2)-X(1));
y_3=Y(1)+k3(2)*(Y(2)-Y(1));
text(double(x_3),double(y_3),ip.Results.text,'color',ip.Results.color,'fontweight','bold','fontsize',ip.Results.ftsiz-12);end
函数调用结果展示
figure;drawmap('湖北省')
text_info('text', '湖北省')
figure;drawmap('湖北省', 'global', 0)
text_info('text', '湖北省', 'xi', 0.7,'yi', 0.9,'color', 'r')
drawmap更新
drawmap更新,只画整个中国的图,不重点标出某一省份
function drawmap(varargin)% drawmap: Add administrative region information for a specified province on the canvas
% use whith default configuration --> drawmap('湖北省')
% use whithout global map --> drawmap('湖北省', 'global', 0)% ------------------------------------------------------------ %
% Author: Muyeqingfeng
% e-mail address: muyeqingfeng@126.com
% Release date: 2023/05/05ip = inputParser;
ip.addParamValue('global', 1)
ip.addParamValue('Province', 0);
parse(ip,varargin{:}); feature('DefaultCharacterSet', 'GBK');
path = 'D:\My_Document\Code\Practice\data\全国shp\最新2021年全国行政区划\';
China1=shaperead([path,'省.shp']);
China2=shaperead([path,'市.shp']);idx1 = 0;
idx2 = [];if ip.Results.Province ~= 0% Provincial boundary infomation for i=1:length(China1)if strcmp(China1(i).x0xCA0xA1,ip.Results.Province), idx1=i;endend% Market boundary informationfor j=1:length(China2)if strcmp(China2(j).x0xCA0xA1,ip.Results.Province), idx2=[idx2,j];endend
endif ip.Results.global == 1% the whole china infoplot([China1(:).X],[China1(:).Y],'color',[0.2 0.2 0.2],'linewidth',1.0); hold on
endif ip.Results.Province ~= 0% the special Provinceplot([China1(idx1).X],[China1(idx1).Y],'color','r','linewidth',1.5); hold on% all of the city of the special Provinceplot([China2(idx2).X],[China2(idx2).Y],'color','k','linewidth',0.8); hold on
end
set(gca,'Layer','top');
end
中国区域地图叠加绘制相关推荐
- vue用 echarts 显示区域地图 并用不同颜色显示每个区域
认定了一个女孩 就要好好的珍惜对待她,人生不容辜负,你必须要更加努力 .加油 骚年. 用 echarts 做动态中国区域地图 或者全国地图 效果如下 做这些 必须先引入echarts 怎么引入的 自己 ...
- antV实现离线中国2D地图并叠加拓扑(一)
业务背景: 中国地图铺满屏幕,屏幕的中间部分动态展示当前区域地图.当前区域有可能是省.市.县等,需要在当前区域展示拓扑站点,并实时弹出小面板展示当前站点详情. 实现方式: antv-G6实现拓扑图,a ...
- js使用百度地图仅显示中国区域,实现大数据热点图
马上又到年底PPT环节了,各位实现效果之后,麻烦留言点赞.. 需求:领导需要在年会上展示我们的用户ip实时数据,做一个网页版的地图,仅仅显示中国区域. 技术分析:echart,hchart等网站都有地 ...
- matlab绘制中国南海地图(九段线小图)
matlab绘制中国南海地图(九段线小图) 网上关于怎么画南海九段线小图的文章不多,在此记录一下. 绘制南海图 首先要下载中国地图的shp文件,参见上一篇文章. %------------------ ...
- 使用Echarts完成对中国地图的绘制
目录 前言 1.什么是Echarts插件 2.如何在vue中使用Echarts 3.中国地图的具体样式 4.如何使用Echarts来完成中国地图的绘制 5.总结 前言 我们在使用代码绘画地图的时候通常 ...
- 使用 Cartopy 绘制区域地图
使用 Cartopy 绘制区域地图 绘制亚洲地区的地形图(Miller 投影),并根据中国地区的 shapefile 绘制各个省份自治区的边界. import matplotlib.pyplot as ...
- 【vue项目使用echarts实现区域地图绘制,且可点击单独区域】
vue项目使用echarts实现区域地图绘制,且可点击单独区域 - 菜鸟程序员的总结 - 博客园
- 地图上分成一块一块区域 高德地图_在谷歌地图上绘制行政区域轮廓【结合高德地图的API】...
实现思路: 1.利用高德地图行政区域API获得坐标列表 2.将坐标列表绘制在谷歌地图上[因为高德地图和国内的谷歌地图都是采用GCJ02坐标系,所有误差很小,可以不进行坐标误差转换] 注意点: 1.用百 ...
- 疫情数据分析平台(五):中国疫情地图绘制
中国疫情地图相比世界疫情地图承载更多功能,因此其技术实现的难度也更高,相比世界地图echarts的绘制,中国疫情地图包含大量同步异步函数的使用,同时包含下钻(点击省份进入各省地图)和返回(回到中国地图 ...
最新文章
- ICRA 2021 | VINS 研讨会概要(附完整视频)
- argis怎么关掉对象捕捉_你和你的网恋对象,都怎么样了?
- 谈谈UIView的几个layout方法-layoutSubviews、layoutIfNeeded、
- JAVA_OA(十四)番外:JAVAWEB防止表单重复提交的方法整合(包括集群部署)
- python调用rust_在 Rust 代码中编写 Python 是种怎样的体验?
- Manjaro使用笔记-使用中国源的方法
- EntiyFramework :Update model from database引起的两个问题
- Windows 11 来了!无缝支持安卓 App界面却像极了macOS
- 滤波效果_各种电源滤波电路分析
- -拳王虚拟项目公社:虚拟产品自动赚钱技术 小白快速赚到钱的秘方
- perl-我的第一个程序
- 科学计算机DEG进入,科学计算器的使用方法(5页)-原创力文档
- haproxy配置timeout
- 移动定位业务之“Cell ID + RTT(小区识别+往返时间)”
- iOS开发:GitHub上传代码错误提示fatal: Authentication failed for 'https://gitee.com/XXX/XXX.git/‘的解决方法
- 点击图片,放大/缩小图片
- 线性代数——分块矩阵计算行列式的方法
- 本月,我最推荐的意外保险排行榜
- 高德地图-根据经纬度获取地址(逆地理编码)
- 新华三半导体:初芯如磐,笃行致远
热门文章
- 抽奖小工具的设计(2)- python
- bigemap软件功能
- openCV3中双目深度BM算法参数解析
- javaweb JSP JAVAJSP 新闻发布系统源码(JSP新闻管理系统)JSP新闻系统
- 微信小程序教程(第四篇)
- 威力导演-CyberLink PowerDirector Ultimate 17 永久启用 安装教程
- 【计算机网络】思科实验(7):网络地址转换之路由器静态NAT模拟
- access 分组序号_ACCESS分组查询
- QB64 -- C++编写的语言
- IPv4, IPv6, IPv9能表示多少IP地址?