了解 gma

gma 是什么?

gma 是一个基于 Python 的地理、气象数据快速处理和数据分析函数包(Geographic and Meteorological Analysis,gma)。gma 网站:地理与气象分析库。

gma 的主要功能有哪些?

气候气象(例如 SPEI、SPI、ET0 等)。
遥感指数(例如 NDVI、EVI、TVDI 等)。
数学运算(例如 数据平滑、评估、滤波、拉伸、增强变换等)。
系统交互(例如 获取路径、重命名、压缩等操作)。
空间杂项(例如 计算空间距离、面积计算,坐标转换、空间插值等操作)。
栅格处理(例如 栅格镶嵌、裁剪、重采样、重投影、格式转换、数据融合等)。
栅格分析(例如 DEM 坡度、坡向、阴影、等值线等计算)。
矢量处理(例如 矢量裁剪、擦除、交集、融合、重投影等)。
地图工具(例如 栅格、矢量数据绘图,指北针、比例尺等生成,坐标系定义等)

gma 的安装要求?

系统 (X64): Window 10+,Linux
Python 版本: 3.8.8 ~ 3.10,建议使用 3.9

gma 哪个版本开始支持空间绘图?

gma 1.1.2 及之后的版本
点击查看:gma 1.1.2 版本的新增内容

基于 gma 绘制简单的世界地图

本文基于 gma 1.1.2 (Python 3.9) ,为大家展示绘制世界地图(gma 内置的世界国家和地区),如果有自有的高精度世界地图,也可按照此方法绘制。

1. 绘制世界地图

from gma.map import plot# 0. 打开 gma 内置的世界矢量
WorldDS = plot.GetWorldDataSource()
WorldLayer = WorldDS.GetLayer(0)# 1.初始化一个地图框,用于绘图
MapF = plot.MapFrame(Axes = None, BaseMapProj = 'WGS84', Extent = None)# 2.将内置的世界矢量图层添加到地图框
MapL1 = MapF.AddLayer(WorldLayer)

2. 其他参数说明

自 gma 1.1.0 起,gma 不在内置中文帮助。

2.1 MapFrame 帮助

'''
Initialize a map frame for plotting a map!**Optional
----------
Axes = None or matplotlib.~.AxesSubplot. Default None.A matplotlib subplot. If None, a default Axes will be created. BaseMapProj = str, int or SpatRef. Default 'WGS84'.Base map coordinate system. All data that added to this frame will be reprojectedto this coordinate system. Can be EPSG, WKT, Proj4, and other types of coordinatecharacters or SpatRef(gma spatial reference) class.Extent = list or None. Default None.Plot [left, bottom, right, top] extent(In WGS84). All data that added to this mapframe will be clipped to this extent. Default(None) is the maximum extent supportedby the base map coordinate system.
'''

2.2 AddLayer 帮助

'''
Add a layer to the map frame.Parameters
----------
GMALayer: gma.algorithm.core.dataio.Layer.A vector layer opened by gma.Open(.GetLayer).**Optional
----------
FID = list or None. Default None.The feature ID of the vector to plot. Default(None) all feature.For more, see gma.~.Layer.FaceColor = str, tuplt, list or None. Default '#BED2FF'.The polygon fill color. Only for 'Polygon' layers. If None, a random color willbe generated. If it is a list, assign a different color to each feature. For more,see matplotlib.EdgeColor = str, tuplt, list or None. Default '#B2B2B2'.The polygon edge color. Only for 'Polygon' layers. If None, a random color willbe generated. If it is a list, assign a different color to each feature.For more, see matplotlib.Hatch = str, list or None. Default None.Filling style. May be {'/', '\', '|', '-', '+', 'x', 'o', 'O', '.', '*'} or acombination thereof. Only for 'Polygon' layers. Default(None) no filling style.If it is a list, assign a different hatch to each feature. For more, see matplotlib.LineStyle = str, list, tuple, or None. Default None.Line style. May be {'-', '--', '-.', ':', '', (offset, on-off-seq), ...}.If it is a list,assign a different line style to each feature. Default(None) no line style.For more, see matplotlib.LineWidth = float or list. Default 0.5.Line width. In font-size units. If it is a list, assign a differentline width to each feature. LineColor = str, tuplt, list or None. Default '#B2B2B2'.The line color. Only for 'Line' layers. If None, a random color will be generated.Ifit is a list, assign a different color to each feature. For more, see matplotlib.PointColor = str, tuplt, list or None. Default '#BED2FF'.The point color. Only for 'Point' layers. If None, a random color will be generated.If it is a list, assign a different color to each feature. For more, see matplotlib.PointSize = float, list or None. Default None.The point size. Only for 'Point' layers. If it is a list, assign a different size to each feature.Default(None) depends on the matplotlib setting.PointMarker = str, list or None. Default None.The point marker. Only for 'Point' layers. Default(None) depends on the matplotlib setting.If it is a list, assign a different marker to each feature.Labels = str or None. Default None.Manually set the feature labels. The number should be the same as the number of layer features.Otherwise, the shortfall will be assigned as null. Default(None) no labels.FieldName = list, str or None. Default None.Layer field used to configure the label. If 'FieldName' is configured, 'Label' will be disabled.Default(None) no labels.Connector = str. Default ''.If 'FieldName' configures more than one field, the fields are connected with this symbol.Zorder = int or None. Default None.The layer order. Used to control the order of the layers. Default(None) depends on thematplotlib setting.Returns
----------
gma.~.PlotLPolygon/PlotLLine/PlotLPoint.'''

简单的世界地图细节调整

本例仅针对多边形的边界线、填充内容进行示例。其他参数参考2.2 进行调整和测试。

1. 调整边界线

from gma.map import plot# 0. 打开 gma 内置的世界矢量
WorldDS = plot.GetWorldDataSource()
WorldLayer = WorldDS.GetLayer(0)# 1.初始化一个地图框,用于绘图
MapF = plot.MapFrame(Axes = None, BaseMapProj = 'WGS84', Extent = None)# 2.添加图层,并调整 边界线的颜色和线的宽度
MapL1 = MapF.AddLayer(WorldLayer, EdgeColor = 'gray', LineWidth = 0.2)

2. 调整填充色

from gma.map import plot# 0. 打开 gma 内置的世界矢量
WorldDS = plot.GetWorldDataSource()
WorldLayer = WorldDS.GetLayer(0)# 1.初始化一个地图框,用于绘图
MapF = plot.MapFrame(Axes = None, BaseMapProj = 'WGS84', Extent = None)# 2.添加图层,并调整 填充颜色
MapL1 = MapF.AddLayer(WorldLayer, FaceColor = 'gray')

3. 调整填充样式

from gma.map import plot# 0. 打开 gma 内置的世界矢量
WorldDS = plot.GetWorldDataSource()
WorldLayer = WorldDS.GetLayer(0)# 1.初始化一个地图框,用于绘图
MapF = plot.MapFrame(Axes = None, BaseMapProj = 'WGS84', Extent = None)# 2.添加图层,并调整 填充样式
MapL1 = MapF.AddLayer(WorldLayer, Hatch = '*/')

4. 为每个国家或地区分配随机颜色

from gma.map import plot# 0. 打开 gma 内置的世界矢量
WorldDS = plot.GetWorldDataSource()
WorldLayer = WorldDS.GetLayer(0)# 1.初始化一个地图框,用于绘图
MapF = plot.MapFrame(Axes = None, BaseMapProj = 'WGS84', Extent = None)# 2.添加图层,并为每个国家或地区分配随机颜色
### FaceColor = None 相当于生成了一个颜色列表,列表中的每个颜色都是随机的。
### 列表颜色数量与国家或地区数量相同(所有类似的参数均可按照此说明配置)。
MapL1 = MapF.AddLayer(WorldLayer, FaceColor = None)

地图框控制

1. 调整底图坐标系

from gma.map import plot# 0. 打开 gma 内置的世界矢量
WorldDS = plot.GetWorldDataSource()
WorldLayer = WorldDS.GetLayer(0)# 1.初始化一个地图框,调整底图坐标系为 WGS 84 / Pseudo-Mercator(EPSG: 3857)
### 又名 web墨卡托投影,Spherical Mercator, Google Maps, OpenStreetMap, Bing, ArcGIS, ESRI等均使用此投影!
MapF = plot.MapFrame(Axes = None, BaseMapProj = 3857, Extent = None)# 2.添加图层
MapL1 = MapF.AddLayer(WorldLayer)

2. 控制显示范围

from gma.map import plot# 0. 打开 gma 内置的世界矢量
WorldDS = plot.GetWorldDataSource()
WorldLayer = WorldDS.GetLayer(0)# 1.初始化一个地图框,用于绘图
MapF = plot.MapFrame(Axes = None, BaseMapProj = 'WGS84', Extent = (-10, 30, 30, 60))# 2.添加图层
MapL1 = MapF.AddLayer(WorldLayer)

gma 地理空间绘图:(1)绘制简单的世界地图-1.地图绘制与细节调整相关推荐

  1. gma 地理空间绘图:(1) 绘制简单的世界地图-3.设置地图框

    内容回顾 gma 地理空间绘图:(1) 绘制简单的世界地图-1.地图绘制与细节调整 gma 地理空间绘图:(1) 绘制简单的世界地图-2.设置经纬网 方法 SetFrame(FrameColor = ...

  2. gma 地理空间绘图:(1) 绘制简单的世界地图-2.设置经纬网

    内容回顾 gma 地理空间绘图:(1)绘制简单的世界地图-1.地图绘制与细节调整 方法 AddGridLines(LONRange = (-180, 180, 15), LATRange = (-90 ...

  3. 基于 Python 的地理空间绘图指南

      大部分情况下,地理绘图可使用 Arcgis 等工具实现.但正版的 Arcgis 并非所有人可以承受.本文基于 Python 的 cartopy 和 matplotlib 等库,为地理空间绘图的代码 ...

  4. 【教程】基于 Python 的地理空间绘图指南

    大部分情况下,地理绘图可使用 ArcGIS 等工具实现.但正版的 ArcGIS 并非所有人可以承受.本文基于 Python 的 cartopy 和 matplotlib 等库,为地理空间绘图的代码实现 ...

  5. Turf.js——用于地理空间分析的js库,处理各种地图算法

    Turf.js--用于地理空间分析的js库,处理各种地图算法 一.官网 中文--https://turfjs.fenxianglu.cn/ 英文--https://turfjs.org/ npm地址- ...

  6. Turf.js(地理空间GIS分析的js库),处理地图相关算法

    场景 Turf.js Advanced geospatial analysis for browsers and Node.js 浏览器和Node.js的高级地理空间分析. 特点 Modular, s ...

  7. 绘制简单的美国疫情地图(plotlty+request)

    首先确定一下项目流程,数据采集→数据存储→数据分析→数据挖掘→数据可视化,这里我用的是python对项目进行可视化处理,python中的plotly图形库可以在线生成交互式的高质量的图形,它可以制作基 ...

  8. 地理空间技术改变世界的未来

    摘要: 地理空间技术是一项重大的科学发现,它将人类的可能性推向了一个全新的水平.那么什么是地理空间技术呢?事实上,它与普通的空间数据不同,地理空间技术的创新使我们能够确定物体或人在地球上的确切位置.人 ...

  9. 2022年10个最佳地理空间数据分析 GIS 软件

    数据可视化并不是简单的把数据变成图表, 而是以数据为视角看待世界.换言之,数据可视化的客体是数据,但我们往往想要的其实是数据视觉,以数据为工具,以可视化为手段,目的是描述真实,探索世界.GIS 就是这 ...

最新文章

  1. java web dao层_java web 中web层直接调用dao层 可以吗?
  2. Java中New一个对象是个怎么样的过程?
  3. 磁盘df看还有剩余空间,但是创建文件时报错,提示磁盘已经满问题解决
  4. redis部署与卸载
  5. 2013_chengdu_visit
  6. 链表竟然比数组慢了1000多倍?(动图+性能评测)
  7. idea非开源安装指南_开发人员开源指南
  8. 上海政府版WINXP真相大揭秘
  9. linux 编写sh文件,linux编写shell脚本程序one官方
  10. PhantomJS其他语言调用
  11. JS 判断是否为IP格式
  12. Java 实现同步的几种方式
  13. EdgeRouterX配置option43使用华为AP连接远程AC的方法
  14. 010Editor逆向分析
  15. 如何批量等比例缩放图片尺寸?
  16. scrapy爬虫框架实现简单案例:爬取阳光平台内容
  17. OpenCV学习笔记(二)—— OpenCV整体结构
  18. 架构师进阶之路,JAVA架构师面试题
  19. Core.bitwise_and()函数解释
  20. Go 每日一库之 cron

热门文章

  1. windows达梦数据库卸载不完全,重新装达梦数据库现有服务失败/该实例名已被其他实例占用
  2. 音频特效生成与算法 1
  3. WebRTC回声抵消模块简要分析
  4. android和Mac共享文件,这可能是 Mac 共享文件最详细的教程了
  5. 解决Manifest merger failed with multiple errors方法
  6. Smarty - 手册 - 第8章 自定义函数 - {cycle}循环
  7. 青藤:容器安全成熟度验证标准之3个层级,12大场景,100+ Checklist
  8. 使用Qt编辑关闭窗口程序的一些见解
  9. Mysql 导入3亿数据
  10. ubuntu18.04 opencv 获取摄像头 (C++/python) 双目摄像头