用巨蟒书写海岸线、边界和河流的图像
pycoast的Python项目详细描述
用于向光栅图像添加海岸线和边框的python包。
安装
pycoast可以使用pip从pypi安装:
pip install pycoast
或者使用Conda Forge频道:
conda install -c conda-forge pycoast
示例
>>> from PIL import Image >>> from pycoast import ContourWriterAGG >>> img = Image.open('BMNG_clouds_201109181715_areaT2.png') >>> proj4_string = '+proj=stere +lon_0=8.00 +lat_0=50.00 +lat_ts=50.00 +ellps=WGS84' >>> area_extent = (-3363403.31,-2291879.85,2630596.69,2203620.1) >>> area_def = (proj4_string, area_extent) >>> cw = ContourWriterAGG('/home/esn/data/gshhs') >>> cw.add_coastlines(img, area_def, resolution='l', level=4) >>> cw.add_rivers(img, area_def, level=5, outline='blue') >>> cw.add_borders(img, area_def, outline=(255, 0, 0)) >>> img.show()