Summarize geospatial raster datasets based on vector geometries
Project description
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
===========
|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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
rasterstats-0.10.0.zip
(19.7 kB
view details)
rasterstats-0.10.0.tar.gz
(14.4 kB
view details)
File details
Details for the file rasterstats-0.10.0.zip
.
File metadata
- Download URL: rasterstats-0.10.0.zip
- Upload date:
- Size: 19.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8903bf1fde127c1d3501a51e38c1721aa2feb8c33de6c39de917ae25469dbba1 |
|
MD5 | b38a3ad426a64cfae954ee8ba43d8134 |
|
BLAKE2b-256 | f5e95a4081f41b952ec4444dc7a93b2b36b2dbfdf4f9b322008ecc8628d6994d |
File details
Details for the file rasterstats-0.10.0.tar.gz
.
File metadata
- Download URL: rasterstats-0.10.0.tar.gz
- Upload date:
- Size: 14.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | eea1dd6db3e7a2fe802d1213777e5a827852fd7cee7c51e5617a186147b36e9e |
|
MD5 | ebe550509e3b2a83905724c34557d133 |
|
BLAKE2b-256 | d485fa566cfedc0894f5a48a1148da9be9257c0deff4869b0496158e20a087c0 |