rasterio

Rasterio reads and writes geospatial raster datasets

https://github.com/rasterio/rasterio

Science Score: 36.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
    11 of 168 committers (6.5%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (12.3%) to scientific vocabulary

Keywords

cli cython gdal gis mapbox-satellite-oss python raster

Keywords from Contributors

geospatial-data ogr closember flexible alignment wms earth-observation wcs web-mapping wfs
Last synced: 6 months ago · JSON representation

Repository

Rasterio reads and writes geospatial raster datasets

Basic Info
Statistics
  • Stars: 2,392
  • Watchers: 141
  • Forks: 545
  • Open Issues: 185
  • Releases: 41
Topics
cli cython gdal gis mapbox-satellite-oss python raster
Created over 12 years ago · Last pushed 6 months ago
Metadata Files
Readme Changelog Contributing License Code of conduct Citation Security Governance Authors

README.rst

========
Rasterio
========

Rasterio reads and writes geospatial raster data.

.. image:: https://github.com/rasterio/rasterio/actions/workflows/tests.yaml/badge.svg
   :target: https://github.com/rasterio/rasterio/actions/workflows/tests.yaml

.. image:: https://github.com/rasterio/rasterio/actions/workflows/test_gdal_latest.yaml/badge.svg
   :target: https://github.com/rasterio/rasterio/actions/workflows/test_gdal_latest.yaml

.. image:: https://github.com/rasterio/rasterio/actions/workflows/test_gdal_tags.yaml/badge.svg
   :target: https://github.com/rasterio/rasterio/actions/workflows/test_gdal_tags.yaml

.. image:: https://img.shields.io/pypi/v/rasterio
   :target: https://pypi.org/project/rasterio/

Geographic information systems use GeoTIFF and other formats to organize and
store gridded, or raster, datasets. Rasterio reads and writes these formats and
provides a Python API based on N-D arrays.

Rasterio 1.4 works with Python >= 3.9, Numpy >= 1.24, and GDAL >= 3.5. Official
binary packages for Linux, macOS, and Windows with most built-in format drivers
plus HDF5, netCDF, and OpenJPEG2000 are available on PyPI.

Read the documentation for more details: https://rasterio.readthedocs.io/.

Example
=======

Here's an example of some basic features that Rasterio provides. Three bands
are read from an image and averaged to produce something like a panchromatic
band.  This new band is then written to a new single band TIFF.

.. code-block:: python

    import numpy as np
    import rasterio

    # Read raster bands directly to Numpy arrays.
    #
    with rasterio.open('tests/data/RGB.byte.tif') as src:
        r, g, b = src.read()

    # Combine arrays in place. Expecting that the sum will
    # temporarily exceed the 8-bit integer range, initialize it as
    # a 64-bit float (the numpy default) array. Adding other
    # arrays to it in-place converts those arrays "up" and
    # preserves the type of the total array.
    total = np.zeros(r.shape)

    for band in r, g, b:
        total += band

    total /= 3

    # Write the product as a raster band to a new 8-bit file. For
    # the new file's profile, we start with the meta attributes of
    # the source file, but then change the band count to 1, set the
    # dtype to uint8, and specify LZW compression.
    profile = src.profile
    profile.update(dtype=rasterio.uint8, count=1, compress='lzw')

    with rasterio.open('example-total.tif', 'w', **profile) as dst:
        dst.write(total.astype(rasterio.uint8), 1)

The output:

.. image:: http://farm6.staticflickr.com/5501/11393054644_74f54484d9_z_d.jpg
   :width: 640
   :height: 581

API Overview
============

Rasterio gives access to properties of a geospatial raster file.

.. code-block:: python

    with rasterio.open('tests/data/RGB.byte.tif') as src:
        print(src.width, src.height)
        print(src.crs)
        print(src.transform)
        print(src.count)
        print(src.indexes)

    # Printed:
    # (791, 718)
    # {u'units': u'm', u'no_defs': True, u'ellps': u'WGS84', u'proj': u'utm', u'zone': 18}
    # Affine(300.0379266750948, 0.0, 101985.0,
    #        0.0, -300.041782729805, 2826915.0)
    # 3
    # [1, 2, 3]

A rasterio dataset also provides methods for getting read/write windows (like
extended array slices) given georeferenced coordinates.

.. code-block:: python

    with rasterio.open('tests/data/RGB.byte.tif') as src:
        window = src.window(*src.bounds)
        print(window)
        print(src.read(window=window).shape)

    # Printed:
    # Window(col_off=0.0, row_off=0.0, width=791.0000000000002, height=718.0)
    # (3, 718, 791)

Rasterio CLI
============

Rasterio's command line interface, named "rio", is documented at `cli.rst
`__. Its ``rio
insp`` command opens the hood of any raster dataset so you can poke around
using Python.

.. code-block:: pycon

    $ rio insp tests/data/RGB.byte.tif
    Rasterio 0.10 Interactive Inspector (Python 3.4.1)
    Type "src.meta", "src.read(1)", or "help(src)" for more information.
    >>> src.name
    'tests/data/RGB.byte.tif'
    >>> src.closed
    False
    >>> src.shape
    (718, 791)
    >>> src.crs
    {'init': 'epsg:32618'}
    >>> b, g, r = src.read()
    >>> b
    masked_array(data =
     [[-- -- -- ..., -- -- --]
     [-- -- -- ..., -- -- --]
     [-- -- -- ..., -- -- --]
     ...,
     [-- -- -- ..., -- -- --]
     [-- -- -- ..., -- -- --]
     [-- -- -- ..., -- -- --]],
                 mask =
     [[ True  True  True ...,  True  True  True]
     [ True  True  True ...,  True  True  True]
     [ True  True  True ...,  True  True  True]
     ...,
     [ True  True  True ...,  True  True  True]
     [ True  True  True ...,  True  True  True]
     [ True  True  True ...,  True  True  True]],
           fill_value = 0)

    >>> np.nanmin(b), np.nanmax(b), np.nanmean(b)
    (0, 255, 29.94772668847656)

Rio Plugins
-----------

Rio provides the ability to create subcommands using plugins.  See
`cli.rst `__
for more information on building plugins.

See the
`plugin registry `__
for a list of available plugins.


Installation
============

See `docs/installation.rst `__

Support
=======

The primary forum for questions about installation and usage of Rasterio is
https://rasterio.groups.io/g/main. The authors and other users will answer
questions when they have expertise to share and time to explain. Please take
the time to craft a clear question and be patient about responses.

Please do not bring these questions to Rasterio's issue tracker, which we want
to reserve for bug reports and other actionable issues.

Development and Testing
=======================

See `CONTRIBUTING.rst `__.

Documentation
=============

See `docs/ `__.

License
=======

See `LICENSE.txt `__.

Authors
=======

The `rasterio` project was begun at Mapbox and was transferred to the `rasterio` Github organization in October 2021.

See `AUTHORS.txt `__.

Changes
=======

See `CHANGES.txt `__.

Who is Using Rasterio?
======================

See `here `__.

Owner

  • Name: rasterio
  • Login: rasterio
  • Kind: organization

GitHub Events

Total
  • Create event: 28
  • Release event: 1
  • Issues event: 108
  • Watch event: 141
  • Delete event: 24
  • Issue comment event: 293
  • Push event: 76
  • Pull request event: 119
  • Pull request review event: 164
  • Pull request review comment event: 120
  • Fork event: 18
Last Year
  • Create event: 28
  • Release event: 1
  • Issues event: 108
  • Watch event: 141
  • Delete event: 24
  • Issue comment event: 293
  • Push event: 76
  • Pull request event: 119
  • Pull request review event: 164
  • Pull request review comment event: 120
  • Fork event: 18

Committers

Last synced: 8 months ago

All Time
  • Total Commits: 3,240
  • Total Committers: 168
  • Avg Commits per committer: 19.286
  • Development Distribution Score (DDS): 0.422
Past Year
  • Commits: 82
  • Committers: 25
  • Avg Commits per committer: 3.28
  • Development Distribution Score (DDS): 0.512
Top Committers
Name Email Commits
Sean Gillies s****s@g****m 1,874
Matthew Perry p****o@g****m 220
Kevin Wurster w****k@g****m 200
Alan D. Snow a****1@g****m 112
Brendan Ward b****d@a****m 109
Jonas Sølvsteen j****e@g****m 59
Vincent Sarago v****o@g****m 43
James McBride j****e@b****u 43
Colin Talbert t****c@u****v 41
Ryan Grout g****r 40
Erik Seglem e****m@g****m 26
Yann-Sebastien Tremblay-Johnston u****t 24
Even Rouault e****t@s****m 23
Seth Fitzsimmons s****h@m****t 23
Amit Kapadia a****t@p****m 22
James Hiebert h****t@u****a 22
Denis Rykov r****d@g****m 19
Adam J. Stewart a****6@g****m 17
dnomadb d****n@m****m 15
Mike Taves m****s@g****m 14
Guillaume Lostis g****s@k****m 14
Kelsey Jordahl k****l@a****u 10
Kirill Kouzoubov K****8@g****m 9
Bas Couwenberg s****c@x****l 8
Idan Miara i****n@m****m 6
Maxim Dubinin s****m@g****o 6
Maxwell Lindsay m****5@g****m 6
dependabot[bot] 4****] 6
Andrew Annex a****y@v****u 6
AsgerPetersen a****n@g****m 5
and 138 more...

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 316
  • Total pull requests: 419
  • Average time to close issues: 6 months
  • Average time to close pull requests: about 2 months
  • Total issue authors: 187
  • Total pull request authors: 56
  • Average comments per issue: 3.14
  • Average comments per pull request: 1.5
  • Merged pull requests: 308
  • Bot issues: 0
  • Bot pull requests: 15
Past Year
  • Issues: 94
  • Pull requests: 169
  • Average time to close issues: 15 days
  • Average time to close pull requests: 3 days
  • Issue authors: 69
  • Pull request authors: 27
  • Average comments per issue: 1.71
  • Average comments per pull request: 1.15
  • Merged pull requests: 113
  • Bot issues: 0
  • Bot pull requests: 3
Top Authors
Issue Authors
  • sgillies (60)
  • snowman2 (13)
  • vincentsarago (8)
  • groutr (7)
  • schwehr (5)
  • AndrewAnnex (4)
  • roelofvandijkO (4)
  • falahfakhri-Iraq (3)
  • scottstanie (3)
  • mathause (3)
  • scottyhq (3)
  • geowurster (3)
  • lagamura (3)
  • DFEvans (3)
  • adehecq (2)
Pull Request Authors
  • sgillies (184)
  • groutr (55)
  • adamjstewart (29)
  • snowman2 (25)
  • dependabot[bot] (15)
  • vincentsarago (9)
  • rouault (8)
  • omarkhan (6)
  • DFEvans (5)
  • QuLogic (4)
  • ebkurtz (4)
  • cclauss (4)
  • AndrewAnnex (4)
  • underchemist (3)
  • theroggy (3)
Top Labels
Issue Labels
bug (70) enhancement (34) GDAL (15) wontfix (14) documentation (14) upstream (13) release (11) cython (7) needs discussion (7) warp (6) needs detail (5) testing (5) resolved (5) good first issue (4) cli (4) notebooks (4) refactor (4) regression (3) advanced (3) deprecation (3) vrt (3) tool (3) admin (3) packaging (3) invalid (3) ci (3) intermediate (2) dependencies (2) env (2) plotting (2)
Pull Request Labels
bug (102) enhancement (63) documentation (38) dependencies (24) release (23) warp (16) cython (9) refactor (7) ci (5) packaging (5) backport-1.4 (4) performance (3) plotting (3) upstream (3) testing (3) github_actions (2) mask (2) caching (2) regression (2) concurrency (2) changelog (2) tool (2) numpy (2) GDAL (2) blocked (1) vrt (1) backport-1.3 (1) needs discussion (1) admin (1) security (1)

Packages

  • Total packages: 4
  • Total downloads:
    • pypi 2,478,086 last-month
  • Total docker downloads: 2,492,569
  • Total dependent packages: 672
    (may contain duplicates)
  • Total dependent repositories: 3,334
    (may contain duplicates)
  • Total versions: 215
  • Total maintainers: 3
pypi.org: rasterio

Fast and direct raster I/O for use with Numpy and SciPy

  • Versions: 166
  • Dependent Packages: 543
  • Dependent Repositories: 2,600
  • Downloads: 2,478,026 Last month
  • Docker Downloads: 2,492,569
Rankings
Dependent packages count: 0.1%
Dependent repos count: 0.2%
Downloads: 0.2%
Docker downloads count: 0.8%
Average: 0.9%
Stargazers count: 1.6%
Forks count: 2.3%
Maintainers (1)
Last synced: 6 months ago
spack.io: py-rasterio

Rasterio reads and writes geospatial raster data. Geographic information systems use GeoTIFF and other formats to organize and store gridded, or raster, datasets. Rasterio reads and writes these formats and provides a Python API based on N-D arrays.

  • Versions: 7
  • Dependent Packages: 7
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Forks count: 4.1%
Average: 4.2%
Stargazers count: 5.2%
Dependent packages count: 7.6%
Maintainers (1)
Last synced: about 1 year ago
conda-forge.org: rasterio
  • Versions: 32
  • Dependent Packages: 122
  • Dependent Repositories: 733
Rankings
Dependent packages count: 0.6%
Dependent repos count: 0.9%
Average: 4.5%
Forks count: 7.3%
Stargazers count: 9.1%
Last synced: 6 months ago
pypi.org: geoai-rasterio

Fast and direct raster I/O for use with Numpy and SciPy

  • Versions: 10
  • Dependent Packages: 0
  • Dependent Repositories: 1
  • Downloads: 60 Last month
Rankings
Stargazers count: 1.6%
Forks count: 2.3%
Dependent packages count: 10.1%
Average: 16.9%
Dependent repos count: 21.6%
Downloads: 48.9%
Maintainers (1)
Last synced: 6 months ago

Dependencies

.github/workflows/test_gdal_latest.yaml actions
  • actions/checkout v3 composite
.github/workflows/tests.yaml actions
  • actions/checkout v3 composite
  • actions/checkout v2 composite
  • actions/setup-python v4 composite
  • codecov/codecov-action v3 composite
  • s-weigand/setup-conda v1 composite
Dockerfile docker
  • gdal latest build
  • osgeo/gdal ${GDAL} build
requirements-dev.txt pypi
  • cython * development
  • delocate * development
  • hypothesis * development
  • mypy * development
  • numpydoc * development
  • packaging * development
  • pytest * development
  • pytest-cov >=2.2.0 development
  • pytest-randomly ==3.10.1 development
  • shapely * development
  • sphinx * development
  • sphinx-click * development
  • sphinx-rtd-theme * development
  • wheel * development
requirements.txt pypi
  • affine *
  • attrs >=19.2.0
  • boto3 >=1.3.1
  • click *
  • click-plugins *
  • cligj >=0.5
  • matplotlib *
  • numpy >=1.10
  • setuptools >=20.0
  • snuggs *
.github/workflows/test_gdal_build.yaml actions
  • actions/checkout v4 composite
  • actions/upload-artifact v3 composite
.github/workflows/test_gdal_dispatch.yaml actions
.github/workflows/test_gdal_tags.yaml actions
  • actions/checkout v4 composite
  • actions/download-artifact v3 composite
  • actions/setup-python v4 composite
  • actions/upload-artifact v3 composite
docs/environment.yml pypi
pyproject.toml pypi
setup.py pypi