NCL绘制中国地图

现在正在学NCL,用它绘制了一样中国地图

load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"

begin

;---Area to zoom in on.
  minlat = 17 
  maxlat = 55
  minlon = 72
  maxlon = 136

  wks  = gsn_open_wks("png","China_Map")

    mpres                         = True
    mpres@gsnMaximize             = True
    mpres@gsnDraw                 = False
    mpres@gsnFrame                = False
    
	mpres@mpDataBaseVersion     = "LowRes"
	mpres@mpOutlineOn           = False 

    mpres@mpLandFillColor         = "white"
    mpres@mpOceanFillColor        = "white"
    mpres@mpInlandWaterFillColor  = "white"

;---Zoom in on area of interest
    mpres@mpLimitMode           = "LatLon"
    mpres@mpMinLatF               = minlat 
    mpres@mpMaxLatF               = maxlat 
    mpres@mpMinLonF               = minlon
    mpres@mpMaxLonF               = maxlon

  map_plot = gsn_csm_map(wks,mpres)   ; Create map, but don't draw it yet.
;****************************************************************************
; sections for shapefiles
;****************************************************************************
;---适合中国的国界地图
  shpfn1="bou1_4l.shp"
  lnres        = True
  lnres@minlat = minlat
  lnres@maxlat = maxlat
  lnres@minlon = minlon
  lnres@maxlon = maxlon
  shp_plot1     = gsn_add_shapefile_polylines(wks,map_plot,shpfn1,lnres)
  
 ;---加上省级区域地图 
  shpfn2="bou2_4p.shp"
  gres        = True
  gres@minlat = minlat
  gres@maxlat = maxlat
  gres@minlon = minlon
  gres@maxlon = maxlon
  gres@gsEdgesOn   =True
  gres@gsEdgeColor   ="blue"
  shp_plot2     = gsn_add_shapefile_polygons(wks,map_plot,shpfn2,gres)
  
 ;---加上一级河流 
  shpfn3="hyd1_4l.shp"
  lnres3        = True
  lnres3@minlat = minlat
  lnres3@maxlat = maxlat
  lnres3@minlon = minlon
  lnres3@maxlon = maxlon
  shp_plot3     = gsn_add_shapefile_polylines(wks,map_plot,shpfn3,lnres3)

  maximize_output(wks,False)

end
效果如下:

NCL绘制中国地图_第1张图片

你可能感兴趣的:(NCL绘制中国地图)