Skip to main content
rasterstats
===========

|BuildStatus|_
|CoverageStatus|_

``rasterstats`` is a Python module for summarizing geospatial raster datasets based on vector geometries.
It includes functions for **zonal statistics** and interpolated **point queries**. The command-line interface allows for
easy interoperability with other GeoJSON tools.

Documentation
-------------
For details on installation and usage, visit the documentation at `http://pythonhosted.org/rasterstats <http://pythonhosted.org/rasterstats/>`_.

What does it do?
----------------
Given a vector layer and a raster band, calculate the summary statistics of each vector geometry.
For example, with a polygon vector layer and a digital elevation model (DEM) raster, compute the
mean elevation of each polygon.

.. figure:: https://github.com/perrygeo/python-raster-stats/raw/master/docs/img/zones_elevation.png
:align: center
:alt: zones elevation

Command Line Quick Start
------------------------

The command line interfaces to zonalstats and point_query
are `rio` subcommands which read and write geojson features

.. code-block:: bash

$ fio cat polygon.shp | rio zonalstats -r elevation.tif

$ fio cat points.shp | rio pointquery -r elevation.tif

See the `CLI Docs <http://pythonhosted.org/rasterstats/cli.html>`_. for more detail.

Python Quick Start
-----------

For zonal statistics

.. code-block:: python

>>> from rasterstats import zonal_stats
>>> stats = zonal_stats("tests/data/polygons.shp", "tests/data/elevation.tif")
>>> stats[1].keys()
['count', 'min', 'max', 'mean']
>>> [f['mean'] for f in stats]
[756.6057470703125, 114.660084635416666]

and for point queries

.. code-block:: python

>>> from rasterstats import point_query
>>> point = "POINT(245309 1000064)"
>>> point_query(point, "tests/data/elevation.tif")
[723.9872347624]


Issues
------

Find a bug? Report it via github issues by providing

- a link to download the smallest possible raster and vector dataset necessary to reproduce the error
- python code or command to reproduce the error
- information on your environment: versions of python, gdal and numpy and system memory

.. |BuildStatus| image:: https://api.travis-ci.org/perrygeo/python-rasterstats.png
.. _BuildStatus: https://travis-ci.org/perrygeo/python-rasterstats

.. |CoverageStatus| image:: https://coveralls.io/repos/perrygeo/python-rasterstats/badge.png
.. _CoverageStatus: https://coveralls.io/r/perrygeo/python-raster-stats

Metadata

Release files for rasterstats 0.10.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distributions (sdists)

Source distribution for rasterstats 0.10.3
File Size Uploaded
rasterstats-0.10.3.zip 20.7 kB Details
rasterstats-0.10.3.tar.gz 14.7 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for rasterstats 0.10.3
File Interpreter ABI Platform
rasterstats-0.10.3-py3-none-any.whl Python 3 none any Details
rasterstats-0.10.3-py2-none-any.whl Python 2 none any Details

Total release size: 70.2 kB

Release files / rasterstats-0.10.3.zip

Download URL rasterstats-0.10.3.zip
Size 20.7 kB
Tags Source
SHA-256 checksum
How to use checksums
86081cd99ac5f3d86a928264205f23590a26640c1a8d9c763b45fbfdf4e6ec87
BLAKE2b-256 checksum
How to use checksums
c1e6837d7099cd7712d28e38137a9f38656b8427a09f80cab23ad5e4a2374c3b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / rasterstats-0.10.3.tar.gz

Download URL rasterstats-0.10.3.tar.gz
Size 14.7 kB
Tags Source
SHA-256 checksum
How to use checksums
7a4a79d71fbfb15812ee40081a8fd321039e9b26f389f7ec456c657c3298a818
BLAKE2b-256 checksum
How to use checksums
ddea0b6e2b0a66404a18542733ae84d65268331320587dae553a8209f027751f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / rasterstats-0.10.3-py3-none-any.whl

Download URL rasterstats-0.10.3-py3-none-any.whl
Size 17.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fa91c6501e26917a6495a106e8adc1fd9c9c9176d144ad9866c1b034ac3cf1ab
BLAKE2b-256 checksum
How to use checksums
ddf3afaf8aa05953e5ff2cddd5400ca69f112e874a77e3a6a48d7a2db1b35c3b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / rasterstats-0.10.3-py2-none-any.whl

Download URL rasterstats-0.10.3-py2-none-any.whl
Size 17.4 kB
Tags Python 2
SHA-256 checksum
How to use checksums
411f07d9cb4e6aedb6a6c4c96809f41d028ae3b772dfcbfec1cdefcf7e9209f9
BLAKE2b-256 checksum
How to use checksums
2a36c9fcc84e5084480aa415b2b62b92f2334283fa2c9097a5b5a1bf7b81bf01
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

0.21.0

2 release files

0.20.0

2 release files

0.19.0

2 release files

0.18.0

2 release files

0.17.0

2 release files

0.16.0

2 release files

0.15.0

2 release files

0.14.0

2 release files

0.13.0

2 release files

0.12.1

2 release files

This release

0.10.3 This release

4 release files

0.10.2

2 release files

0.10.0

2 release files

0.9.2

2 release files

0.9.1

2 release files

0.9.0

2 release files

0.8.0

2 release files

0.7.2

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6

2 release files

0.5

2 release files

0.4

2 release files

0.3.5

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

3 release files

0.3.1

1 release file

0.3

1 release file

0.2

1 release file

0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page