You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在Python地理坐标轴上绘制内置ICAO航路点符号?

关于ICAO航路点符号的LaTeX字体及Python批量绘制方案

一、LaTeX/字体包中的符号实现

标准LaTeX默认字体和常见通用字体包(如fontawesome、tikz)里没有直接匹配ICAO规范的航路点符号,但可以通过组合元素快速实现,无需额外安装专用字体:

  • 飞经航路点(圆圈包围四角星):用tikz组合圆形和四角星绘制,示例代码:
    \documentclass{standalone}
    \usepackage{tikz}
    \begin{document}
    \tikz{
      \node[draw, circle, inner sep=0pt, minimum size=14pt] {
        \node[star, star points=4, star point ratio=2, inner sep=2pt] {};
      };
    }
    \end{document}
    
  • 飞越航路点(带镂空圆的四角星):先画四角星,再叠加空心圆形描边,示例代码:
    \documentclass{standalone}
    \usepackage{tikz}
    \begin{document}
    \tikz{
      \node[star, star points=4, star point ratio=2, inner sep=3pt] {};
      \node[draw, circle, inner sep=0pt, minimum size=14pt, fill=none] {};
    }
    \end{document}
    

如果追求现成字体符号,部分航空专业字体库(非LaTeX默认包)会包含这类符号,但需要自行下载安装后在LaTeX中调用。

二、Python地理坐标轴(geoaxis)上的批量绘制方法

以matplotlib+cartopy的地理绘图场景为例,推荐自定义marker或双marker叠加的方式,完全支持批量绘制,无需后期处理:

1. 自定义精准marker(严格匹配ICAO样式)

通过matplotlib的Path类定义航路点的矢量路径,可直接作为marker使用:

import matplotlib.pyplot as plt
from matplotlib.path import Path
import cartopy.crs as ccrs

# 创建飞经航路点marker(圆圈+四角星)
def get_flyby_marker():
    # 四角星顶点坐标(正四角星)
    star_verts = [
        (0, 1), (0.707, 0.707), (1, 0), (0.707, -0.707),
        (0, -1), (-0.707, -0.707), (-1, 0), (-0.707, 0.707), (0, 1)
    ]
    # 圆形路径
    circle_path = Path.unit_circle()
    # 组合路径:先画圆,再画四角星
    verts = circle_path.vertices.tolist() + star_verts
    codes = circle_path.codes.tolist() + [Path.MOVETO] + [Path.LINETO]*8
    return Path(verts, codes)

# 创建飞越航路点marker(空心圆+四角星)
def get_flyover_marker():
    star_verts = [
        (0, 1), (0.707, 0.707), (1, 0), (0.707, -0.707),
        (0, -1), (-0.707, -0.707), (-1, 0), (-0.707, 0.707), (0, 1)
    ]
    circle_path = Path.unit_circle()
    # 组合路径:先画四角星,再画空心圆描边
    verts = star_verts + circle_path.vertices.tolist()
    codes = [Path.MOVETO] + [Path.LINETO]*8 + circle_path.codes.tolist()
    return Path(verts, codes)

# 批量绘制示例
fig, ax = plt.subplots(subplot_kw={'projection': ccrs.PlateCarree()})
ax.coastlines()

# 模拟航路点数据
flyby_locs = [(116, 39), (120, 35), (118, 32)]  # 飞经点经纬度
flyover_locs = [(119, 37), (117, 34)]  # 飞越点经纬度

# 绘制飞经点
flyby_marker = get_flyby_marker()
for lon, lat in flyby_locs:
    ax.plot(lon, lat, marker=flyby_marker, markersize=15, color='#d93a3e', transform=ccrs.PlateCarree())

# 绘制飞越点
flyover_marker = get_flyover_marker()
for lon, lat in flyover_locs:
    ax.plot(lon, lat, marker=flyover_marker, markersize=15, color='#3a7bd5', transform=ccrs.PlateCarree())

plt.show()

2. 简化版:双marker叠加(快速实现)

如果不需要绝对精准的样式,可直接用matplotlib内置marker叠加,代码更简洁:

import matplotlib.pyplot as plt
import cartopy.crs as ccrs

fig, ax = plt.subplots(subplot_kw={'projection': ccrs.PlateCarree()})
ax.coastlines()

flyby_locs = [(116, 39), (120, 35), (118, 32)]
flyover_locs = [(119, 37), (117, 34)]

# 飞经航路点:红色实心圆+白色正方形(近似四角星)
for lon, lat in flyby_locs:
    ax.plot(lon, lat, marker='o', markersize=15, color='#d93a3e', transform=ccrs.PlateCarree())
    ax.plot(lon, lat, marker='s', markersize=8, color='white', transform=ccrs.PlateCarree())

# 飞越航路点:蓝色正方形+空心圆描边
for lon, lat in flyover_locs:
    ax.plot(lon, lat, marker='s', markersize=8, color='#3a7bd5', transform=ccrs.PlateCarree())
    ax.plot(lon, lat, marker='o', markersize=15, color='none', markeredgecolor='#3a7bd5', transform=ccrs.PlateCarree())

plt.show()

内容的提问来源于stack exchange,提问作者EJSABOLK

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.10 02:44:57