Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pytroll/pycoast
Python package for adding coastlines and borders on raster images
https://github.com/pytroll/pycoast
coastlines hacktoberfest python
Last synced: about 9 hours ago
JSON representation
Python package for adding coastlines and borders on raster images
- Host: GitHub
- URL: https://github.com/pytroll/pycoast
- Owner: pytroll
- License: gpl-3.0
- Created: 2015-03-24T19:37:36.000Z (almost 10 years ago)
- Default Branch: main
- Last Pushed: 2024-12-03T02:39:37.000Z (about 1 month ago)
- Last Synced: 2024-12-29T00:27:43.211Z (7 days ago)
- Topics: coastlines, hacktoberfest, python
- Language: Python
- Homepage: http://pycoast.readthedocs.org/en/latest/
- Size: 31 MB
- Stars: 40
- Watchers: 8
- Forks: 20
- Open Issues: 10
-
Metadata Files:
- Readme: README
- Changelog: CHANGELOG.md
- License: LICENSE.txt
- Authors: AUTHORS.md
Awesome Lists containing this project
README
PyCoast
=======.. image:: https://github.com/pytroll/pycoast/workflows/CI/badge.svg?branch=main
:target: https://github.com/pytroll/pycoast/actions?query=workflow%3A%22CI%22.. image:: https://coveralls.io/repos/github/pytroll/pycoast/badge.svg?branch=main
:target: https://coveralls.io/github/pytroll/pycoast?branch=main.. image:: https://img.shields.io/pypi/v/pycoast.svg
:target: https://pypi.python.org/pypi/pycoast.. image:: https://results.pre-commit.ci/badge/github/pytroll/pycoast/main.svg
:target: https://results.pre-commit.ci/latest/github/pytroll/pycoast/main
:alt: pre-commit.ci statusPython package for adding coastlines, borders, rivers, lakes, cities, and other
overlays to raster images.Installation
------------PyCoast can be installed from PyPI using pip::
pip install pycoast
Or with conda using the conda-forge channel::
conda install -c conda-forge pycoast
Example
-------::
>>> 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()