zh-CN National Map

Import easyclimate-map for loading China boundary data, matplotlib.pyplot for plotting, and cartopy.crs for map projections. These libraries together support the retrieval and visualization of geographic data.

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

Line

Use easyclimate_map.get_zh_CN_nation(type="line") to retrieve the line-type GeoDataFrame of China’s national boundaries. This data includes boundary line segments and can be used to draw outlines. Output: Print the GeoDataFrame to verify data loading.

zh_border_line = eclmap.get_zh_CN_nation(type = "line")
zh_border_line
FNODE_ TNODE_ LPOLY_ RPOLY_ LENGTH BOU1_4M_ BOU1_4M_ID GBCODE geometry
0 929 928 1 197 0.525 1 369 61010 LINESTRING (121.00548 53.28751, 121.00812 53.2...
1 928 930 1 197 5.179 2 321 61010 LINESTRING (121.48844 53.33265, 121.49954 53.3...
2 931 929 1 197 2.159 3 1001 61010 LINESTRING (120.64791 52.56527, 120.64351 52.5...
3 930 932 1 197 2.341 4 337 61010 LINESTRING (125.72549 52.87209, 125.73853 52.8...
4 933 931 1 197 2.063 5 1001 61010 LINESTRING (119.97117 51.48934, 119.97012 51.4...
... ... ... ... ... ... ... ... ... ...
1377 918 919 1 1 0.045 1378 1 26100 LINESTRING (112.6427 5.38615, 112.64041 5.3858...
1378 920 921 1 1 0.071 1379 2 26100 LINESTRING (112.28411 3.97788, 112.28306 3.979...
1379 922 923 1 1 0.055 1380 3 26100 LINESTRING (112.29087 3.88075, 112.29078 3.882...
1380 924 925 1 1 0.052 1381 1 26100 LINESTRING (112.06014 3.86478, 112.05986 3.866...
1381 926 927 1 1 1.112 1382 1001 61010 LINESTRING (111.79456 3.40848, 111.85775 3.422...

1382 rows × 9 columns



Use GeoPandas’ plot() method for quick visualization of the boundary line. This step is for initial data inspection without custom projections.

zh_border_line.plot()
plot zh CN nation
<Axes: >

Create a subplot with PlateCarree projection (central longitude 180°), set geographic extent [70-140°E, 0-50°N]. Add gridlines, coastlines, and China’s boundary line geometries (red lines, no fill). This step demonstrates advanced map projections and geometry overlays. Parameter Details:

  • set_extent: Defines the map display range.

  • gridlines: Adds latitude/longitude grid with labels.

  • coastlines: Draws global coastlines (50m resolution).

  • add_geometries: Overlays boundary geometries with red edges, line width 0.3.

fig, ax = plt.subplots(subplot_kw={"projection": ccrs.PlateCarree(central_longitude=180)})

ax.set_extent([70, 140, 0, 50])
ax.gridlines(
    draw_labels=["left", "bottom"],
    color="grey",
    alpha=0.5, linestyle="--"
)
ax.coastlines(color="k", lw = 0.5, resolution = "50m")
ax.add_geometries(
    zh_border_line.geometry,
    crs = ccrs.PlateCarree(),
    facecolor = "none",
    edgecolor = "r",
    lw = 0.3
)
plot zh CN nation
<cartopy.mpl.feature_artist.FeatureArtist object at 0x7fa8b8054740>

Polygon

Use easyclimate_map.get_zh_CN_nation(type="polygon") to retrieve the polygon-type GeoDataFrame of China’s national boundaries. This data includes closed polygon areas for boundaries and can be used for area filling.

zh_border_polygon = eclmap.get_zh_CN_nation(type = "polygon")
zh_border_polygon
AREA PERIMETER BOU1_4M_ BOU1_4M_ID NAME geometry
0 0.001 0.168 2 507 中华人民共和国 POLYGON ((123.00028 39.27521, 123.00566 39.274...
1 0.000 0.025 3 510 中华人民共和国 POLYGON ((122.80147 39.25343, 122.80116 39.254...
2 0.000 0.022 4 517 中华人民共和国 POLYGON ((122.75321 39.2369, 122.75498 39.2371...
3 0.000 0.086 5 519 中华人民共和国 POLYGON ((122.76586 39.229, 122.77245 39.23176...
4 0.003 0.322 6 548 中华人民共和国 POLYGON ((123.14856 39.02794, 123.13866 39.031...
... ... ... ... ... ... ...
889 0.000 0.023 891 3312 中华人民共和国 POLYGON ((111.19925 19.9143, 111.20258 19.9145...
890 0.000 0.022 892 3313 中华人民共和国 POLYGON ((111.20709 19.89064, 111.2097 19.8914...
891 0.000 0.074 893 3314 中华人民共和国 POLYGON ((110.76928 19.44351, 110.76662 19.436...
892 0.000 0.055 894 3239 中华人民共和国 POLYGON ((108.66445 19.29876, 108.66 19.29929,...
893 0.000 0.085 895 3248 中华人民共和国 POLYGON ((110.47311 18.69579, 110.47771 18.686...

894 rows × 6 columns



Use GeoPandas’ plot() method for quick visualization of the boundary polygon. This step is for initial data inspection without custom projections. Output: Display the default Matplotlib plot of the filled boundary.

zh_border_polygon.plot()
plot zh CN nation
<Axes: >

Create a subplot with PlateCarree projection (central longitude 180°), set geographic extent [70-140°E, 0-50°N]. Add gridlines, coastlines, and China’s boundary polygon geometries (light blue fill, no edges). This step demonstrates area fill effects, suitable for region highlighting or climate zoning maps. Parameter Details:

  • Similar to above step, but with facecolor=”lightblue” for area fill and edgecolor=”none” for no borders.

  • Applicable for overlaying other data layers, such as temperature fields or precipitation distributions.

fig, ax = plt.subplots(subplot_kw={"projection": ccrs.PlateCarree(central_longitude=180)})

ax.set_extent([70, 140, 0, 50])
ax.gridlines(
    draw_labels=["left", "bottom"],
    color="grey",
    alpha=0.5, linestyle="--"
)
ax.coastlines(color="k", lw = 0.5, resolution = "50m")
ax.add_geometries(
    zh_border_polygon.geometry,
    crs = ccrs.PlateCarree(),
    facecolor = "lightblue",
    edgecolor = "none",
    lw = 0.3
)
plot zh CN nation
<cartopy.mpl.feature_artist.FeatureArtist object at 0x7fa8b80154c0>

Total running time of the script: (0 minutes 7.216 seconds)